EtcPal
0.4.1
ETC Platform Abstraction Layer (EtcPal)
|
View other versions:
|
An object representing the current local time with millisecond resolution for logging purposes.
Can also be invalid, which means it does not hold a valid timestamp.
Public Member Functions | |
LogTimestamp ()=default | |
Construct an invalid timestamp by default. | |
constexpr | LogTimestamp (unsigned int year, unsigned int month, unsigned int day, unsigned int hour, unsigned int minute, unsigned int second, unsigned int msec=0, int utc_offset=0) |
Create a timestamp representing the current time. More... | |
bool | IsValid () const noexcept |
Whether this timestamp represents a valid time. | |
constexpr const EtcPalLogTimestamp & | get () const noexcept |
Get a const reference to the underlying C type. | |
ETCPAL_CONSTEXPR_14 EtcPalLogTimestamp & | get () noexcept |
Get a mutable reference to the underlying C type. | |
Static Public Member Functions | |
static LogTimestamp | Invalid () |
Construct an invalid timestamp. | |
|
constexpr |
Create a timestamp representing the current time.
year | Absolute year. Valid range 0-9999. |
month | Month of the year. Valid range 1-12 (starting with 1 for January). |
day | Day of the month. Valid range 1-31. |
hour | Hours since midnight. Valid range 0-23. |
minute | Minutes past the current hour. Valid range 0-59. |
second | Seconds past the current minute. Valid range 0-60 (to handle leap seconds). |
msec | Milliseconds past the current second. Valid range 0-999. |
utc_offset | The local offset from UTC in minutes. |