|
| Time () noexcept |
| Initialize time with an epoch time. More...
|
|
| Time (int year, int month, int day, int hour=0, int minute=0, int second=0, int millisecond=0, int microsecond=0, int nanosecond=0) |
| Initialize time with a given date & time components (year, month, day, hour, minute, second, etc.) More...
|
|
| Time (const Time &) noexcept=default |
|
| Time (Time &&) noexcept=default |
|
| ~Time () noexcept=default |
|
Time & | operator= (const Timestamp ×tamp) |
|
Time & | operator= (const Time &) noexcept=default |
|
Time & | operator= (Time &&) noexcept=default |
|
Time & | operator+= (const Timespan &offset) |
|
Time & | operator-= (const Timespan &offset) |
|
std::chrono::time_point< std::chrono::system_clock > | chrono () const |
| Convert date & time to the std::chrono time point. More...
|
|
int | year () const noexcept |
| Get year value (1970-2038 for 32-bit or 1970-3000 for 64-bit) More...
|
|
int | month () const noexcept |
| Get month value (1-12) More...
|
|
Weekday | weekday () const noexcept |
| Get weekday. More...
|
|
int | day () const noexcept |
| Get day value (1-31) More...
|
|
int | hour () const noexcept |
| Get hour value (0-23) More...
|
|
int | minute () const noexcept |
| Get minute value (0-59) More...
|
|
int | second () const noexcept |
| Get second value (0-59) More...
|
|
int | millisecond () const noexcept |
| Get millisecond value (0-999) More...
|
|
int | microsecond () const noexcept |
| Get microsecond value (0-999) More...
|
|
int | nanosecond () const noexcept |
| Get nanosecond value (0-999) More...
|
|
UtcTimestamp | utcstamp () const |
| Get UTC timestamp from the current date & time value. More...
|
|
LocalTimestamp | localstamp () const |
| Get local timestamp from the current date & time value. More...
|
|
void | swap (Time &time) noexcept |
| Swap two instances. More...
|
|
|
Time | operator+ (const Time &time, const Timespan &offset) |
|
Time | operator+ (const Timespan &offset, const Time &time) |
|
Time | operator- (const Time &time, const Timespan &offset) |
|
Time | operator- (const Timespan &offset, const Time &time) |
|
Timespan | operator- (const Time &time1, const Time &time2) |
|
bool | operator== (const Time &time, const Timestamp ×tamp) |
|
bool | operator== (const Timestamp ×tamp, const Time &time) |
|
bool | operator== (const Time &time1, const Time &time2) noexcept |
|
bool | operator!= (const Time &time, const Timestamp ×tamp) |
|
bool | operator!= (const Timestamp ×tamp, const Time &time) |
|
bool | operator!= (const Time &time1, const Time &time2) noexcept |
|
bool | operator> (const Time &time, const Timestamp ×tamp) |
|
bool | operator> (const Timestamp ×tamp, const Time &time) |
|
bool | operator> (const Time &time1, const Time &time2) noexcept |
|
bool | operator< (const Time &time, const Timestamp ×tamp) |
|
bool | operator< (const Timestamp ×tamp, const Time &time) |
|
bool | operator< (const Time &time1, const Time &time2) noexcept |
|
bool | operator>= (const Time &time, const Timestamp ×tamp) |
|
bool | operator>= (const Timestamp ×tamp, const Time &time) |
|
bool | operator>= (const Time &time1, const Time &time2) noexcept |
|
bool | operator<= (const Time &time, const Timestamp ×tamp) |
|
bool | operator<= (const Timestamp ×tamp, const Time &time) |
|
bool | operator<= (const Time &time1, const Time &time2) noexcept |
|
void | swap (Time &time1, Time &time2) noexcept |
|
Time.
Time wraps date & time in a single object with a set of accessors - year, month, day, hours, minutes, seconds, milliseconds, microseconds or nanoseconds.
32-bit: time is limited in range 1970-01-01T00:00:00Z - 2038-01-18T23:59:59Z 64-bit: time is limited in range 1970-01-01T00:00:00Z - 3000-12-31T23:59:59Z
Not thread-safe.
- Examples
- time_time.cpp.
Definition at line 47 of file time.h.
CppCommon::Time::Time |
( |
int |
year, |
|
|
int |
month, |
|
|
int |
day, |
|
|
int |
hour = 0 , |
|
|
int |
minute = 0 , |
|
|
int |
second = 0 , |
|
|
int |
millisecond = 0 , |
|
|
int |
microsecond = 0 , |
|
|
int |
nanosecond = 0 |
|
) |
| |
|
explicit |
Initialize time with a given date & time components (year, month, day, hour, minute, second, etc.)
- Parameters
-
year | - Year value (1970-2038 for 32-bit or 1970-3000 for 64-bit) |
month | - Month value (1-12) |
day | - Day value (1-31) |
hour | - Hour value (0-23) (default is 0) |
minute | - Minute value (0-59) (default is 0) |
second | - Second value (0-59) (default is 0) |
millisecond | - Millisecond value (0-999) (default is 0) |
microsecond | - Microsecond value (0-999) (default is 0) |
nanosecond | - Nanosecond value (0-999) (default is 0) |
Definition at line 42 of file time.cpp.