EtcPal  0.4.1
ETC Platform Abstraction Layer (EtcPal)
View other versions:
LogTimestamp Class Reference

Overview

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 EtcPalLogTimestampget () const noexcept
 Get a const reference to the underlying C type.
 
ETCPAL_CONSTEXPR_14 EtcPalLogTimestampget () noexcept
 Get a mutable reference to the underlying C type.
 

Static Public Member Functions

static LogTimestamp Invalid ()
 Construct an invalid timestamp.
 

Constructor & Destructor Documentation

◆ LogTimestamp()

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 
)
constexpr

Create a timestamp representing the current time.

Parameters
yearAbsolute year. Valid range 0-9999.
monthMonth of the year. Valid range 1-12 (starting with 1 for January).
dayDay of the month. Valid range 1-31.
hourHours since midnight. Valid range 0-23.
minuteMinutes past the current hour. Valid range 0-59.
secondSeconds past the current minute. Valid range 0-60 (to handle leap seconds).
msecMilliseconds past the current second. Valid range 0-999.
utc_offsetThe local offset from UTC in minutes.

The documentation for this class was generated from the following file: