34#include <NDEVR/BaseValues.h>
35#include <NDEVR/ObjectInfo.h>
210 return m_time == time.m_time;
214 return m_time != time.m_time;
218 return m_time < time.m_time;
222 return m_time <= time.m_time;
226 return m_time > time.m_time;
230 return m_time >= time.m_time;
250 static tm getTime(
sint08 time,
bool use_local_time);
251 static uint08 MakeGMTFromLocal(
const tm& time);
252 static uint08 MakeLocalFromGMT(
const tm& time);
254 static constexpr uint02 s_epoch_year = 1970;
255 static constexpr uint02 s_tm_year_base = 1900;
256 static std::function<
uint08(
const tm& tm)> s_make_utc_from_local;
257 static std::function<
uint08(
const tm& tm)> s_make_local_from_utc;
258 static std::function<void(
const Exception& error)> s_clock_error_callback;
259 static sint08 s_nano_second_offset;
277 static const bool Primitive =
true;
279 static const bool Unsigned =
false;
280 static const bool Float =
true;
281 static const bool Integer =
false;
282 static const bool Number =
true;
286 static const bool Boolean =
false;
290 static_assert(
sizeof(Time(0)) == 8,
"Bad time allocation size");
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Exception.hpp:56
Definition Pointer.hpp:62
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
NDEVR_BASE_API uint08 unixTime() const
Converts the timestamp to a UNIX time representation.
Definition Time.cpp:753
NDEVR_BASE_API void setMonth(const uint01 &month, bool is_local_time)
Definition Time.cpp:599
Months
Enumerates the months of the year.
Definition Time.h:64
@ FEBRUARY
Definition Time.h:66
@ NOVEMBER
Definition Time.h:75
@ JANUARY
Definition Time.h:65
@ OCTOBER
Definition Time.h:74
@ DECEMBER
Definition Time.h:76
@ JUNE
Definition Time.h:70
@ MARCH
Definition Time.h:67
@ AUGUST
Definition Time.h:72
@ MAY
Definition Time.h:69
@ SEPTEMBER
Definition Time.h:73
@ JULY
Definition Time.h:71
@ APRIL
Definition Time.h:68
static NDEVR_BASE_API Time SystemTime()
Retrieves the current system time.
Definition Time.cpp:475
static constexpr uint08 SECOND
Definition Time.h:84
static NDEVR_BASE_API void SetClockErrorCallback(const std::function< void(const Exception &error)> &function)
Definition Time.cpp:527
static constexpr uint08 LEAP_YEAR
Definition Time.h:90
NDEVR_BASE_API uint08 leapYearConstant() const
Definition Time.cpp:758
NDEVR_BASE_API uint01 minute(bool is_local_time) const
Definition Time.cpp:727
NDEVR_BASE_API uint01 second(bool is_local_time) const
Definition Time.cpp:733
bool operator!=(const Time &time) const
Definition Time.h:212
NDEVR_BASE_API uint02 monthDay(bool is_local_time) const
Definition Time.cpp:708
NDEVR_BASE_API void setTime(const uint08 &time)
Sets the internal timestamp.
Definition Time.cpp:827
static NDEVR_BASE_API void SetMakeUTCFromLocalFunction(const std::function< uint08(const tm &tm)> &function)
Definition Time.cpp:518
static NDEVR_BASE_API void SetSystemTime(const Time &time)
Sets the application's system clock to a specified Time. Note: Does not affect OS Time.
Definition Time.cpp:745
NDEVR_BASE_API uint02 millisecond() const
Definition Time.cpp:740
NDEVR_BASE_API void setMinute(const uint01 &minute, bool is_local_time)
Definition Time.cpp:548
NDEVR_BASE_API void setHour(const uint01 &hour, bool is_local_time)
Definition Time.cpp:532
NDEVR_BASE_API uint02 yearDay(bool is_local_time) const
Definition Time.cpp:715
static constexpr uint08 WEEK
Definition Time.h:88
NDEVR_BASE_API uint08 daysConstant() const
Definition Time.cpp:767
NDEVR_BASE_API fltp08 julianDay(bool is_local_time) const
Definition Time.cpp:645
constexpr Time()
Default constructor initializing an invalid timestamp.
Definition Time.h:97
NDEVR_BASE_API uint01 hour(bool is_local_time) const
Retrieves the hour component of the timestamp.
Definition Time.cpp:721
constexpr Time(const uint08 &time)
Constructor initializing the timestamp with a specific value.
Definition Time.h:104
NDEVR_BASE_API uint02 month(bool is_local_time) const
Retrieves the month component of the timestamp.
Definition Time.cpp:701
NDEVR_BASE_API void setSecond(const uint01 &second, bool is_local_time)
Definition Time.cpp:564
static constexpr uint08 NANOSECOND
Definition Time.h:81
constexpr uint08 getNanoSeconds() const
Gets the timestamp in nanoseconds.
Definition Time.h:185
static constexpr uint08 MINUTE
Definition Time.h:85
NDEVR_BASE_API void setYear(const uint02 &year, bool is_local_time)
Definition Time.cpp:584
static NDEVR_BASE_API void SetMakeLocalFromUTCFunction(const std::function< uint08(const tm &tm)> &function)
Definition Time.cpp:522
NDEVR_BASE_API uint08 monthsConstant() const
Definition Time.cpp:773
bool operator>=(const Time &time) const
Definition Time.h:228
static constexpr uint08 MICROSECOND
Definition Time.h:82
bool operator<(const Time &time) const
Definition Time.h:216
static constexpr uint08 DAY
Definition Time.h:87
NDEVR_BASE_API String toString(bool get_local_time, const String &format_string) const
Converts the timestamp to a string representation. https://ndevr.org/time-patterns/.
Definition Time.cpp:115
bool operator>(const Time &time) const
Definition Time.h:224
static constexpr uint08 HOUR
Definition Time.h:86
NDEVR_BASE_API void setTimeFromString(const String &time_string, bool is_local_time, const String &format_string)
Converts the timestamp from a string representation. https://ndevr.org/time-patterns/.
Definition Time.cpp:339
bool operator==(const Time &time) const
Definition Time.h:208
NDEVR_BASE_API void setMillisecond(const uint02 &millisecond)
Definition Time.cpp:579
NDEVR_BASE_API void setDayOfYear(const uint02 &day, bool is_local_time)
Definition Time.cpp:629
NDEVR_BASE_API uint02 year(bool is_local_time) const
Retrieves the year component of the timestamp.
Definition Time.cpp:694
static constexpr uint08 MILLISECOND
Definition Time.h:83
static constexpr uint08 YEAR
Definition Time.h:89
NDEVR_BASE_API void setMonthDay(const uint01 &day, bool is_local_time)
Definition Time.cpp:614
bool operator<=(const Time &time) const
Definition Time.h:220
uint08 getMilliseconds() const
Gets the timestamp in milliseconds.
Definition Time.h:193
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
int64_t sint08
-Defines an alias representing an 8 byte, signed integer -Can represent exact integer values -9223372...
Definition BaseValues.hpp:86
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer -Can represent exact integer values 0 thro...
Definition BaseValues.hpp:132
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:109
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
Definition BaseValues.hpp:272
static constexpr ObjectInfo< Time, false, false > VectorSub()
Definition Time.h:287
Information about the object.
Definition ObjectInfo.h:56