![]() |
XII Release 0.1.0
|
The xiiDateTime class can be used to convert xiiTimestamp into a human readable form. More...
#include <Timestamp.h>
Public Member Functions | |
xiiDateTime () | |
Creates an empty date time instance with an invalid date. | |
bool | IsValid () const |
Checks whether all values are within valid ranges. | |
const xiiTimestamp | GetTimestamp () const |
Converts this instance' values into a xiiTimestamp. | |
xiiResult | SetFromTimestamp (xiiTimestamp timestamp) |
Sets this instance to the given timestamp. | |
xiiUInt32 | GetYear () const |
Returns the currently set year. | |
void | SetYear (xiiInt16 iYear) |
Sets the year to the given value. | |
xiiUInt8 | GetMonth () const |
Returns the currently set month. | |
void | SetMonth (xiiUInt8 uiMonth) |
Sets the month to the given value. Asserts that the value is in the valid range [1, 12]. | |
xiiUInt8 | GetDay () const |
Returns the currently set day. | |
void | SetDay (xiiUInt8 uiDay) |
Sets the day to the given value. Asserts that the value is in the valid range [1, 31]. | |
xiiUInt8 | GetDayOfWeek () const |
Returns the currently set day of week. | |
void | SetDayOfWeek (xiiUInt8 uiDayOfWeek) |
Sets the day of week to the given value. Asserts that the value is in the valid range [0, 6]. | |
xiiUInt8 | GetHour () const |
Returns the currently set hour. | |
void | SetHour (xiiUInt8 uiHour) |
Sets the hour to the given value. Asserts that the value is in the valid range [0, 23]. | |
xiiUInt8 | GetMinute () const |
Returns the currently set minute. | |
void | SetMinute (xiiUInt8 uiMinute) |
Sets the minute to the given value. Asserts that the value is in the valid range [0, 59]. | |
xiiUInt8 | GetSecond () const |
Returns the currently set second. | |
void | SetSecond (xiiUInt8 uiSecond) |
Sets the second to the given value. Asserts that the value is in the valid range [0, 59]. | |
xiiUInt32 | GetMicroseconds () const |
Returns the currently set microseconds. | |
void | SetMicroseconds (xiiUInt32 uiMicroSeconds) |
Sets the microseconds to the given value. Asserts that the value is in the valid range [0, 999999]. | |
Static Public Member Functions | |
static xiiDateTime | MakeZero () |
Returns a date time that is all zero. | |
static xiiDateTime | MakeFromTimestamp (xiiTimestamp timestamp) |
Sets this instance to the given timestamp. | |
The xiiDateTime class can be used to convert xiiTimestamp into a human readable form.
Note: As xiiTimestamp is microseconds since Unix epoch, the values in this class will always be in UTC.
|
default |
Creates an empty date time instance with an invalid date.
Day, Month and Year will be invalid and must be set.
|
nodiscard |
Converts this instance' values into a xiiTimestamp.
The conversion is done via the OS and can fail for values that are outside the supported range. In this case, the returned value will be invalid. Anything after 1970 and before the not so distant future should be safe.
|
staticnodiscard |
Sets this instance to the given timestamp.
This calls SetFromTimestamp() internally and asserts that the conversion succeeded. Use SetFromTimestamp() directly, if you need to be able to react to invalid data.
xiiResult xiiDateTime::SetFromTimestamp | ( | xiiTimestamp | timestamp | ) |
Sets this instance to the given timestamp.
The conversion is done via the OS and will fail for invalid dates and values outside the supported range, in which case XII_FAILURE will be returned. Anything after 1970 and before the not so distant future should be safe.