Represents timestamp without time-zone information. More...
Public Member Functions | |
Timestamp () | |
Initializes as Jan 1, 0001, 00:00:00. | |
Timestamp (unsigned int year, Month month, unsigned int day) | |
Initializes as date with zero time component. More... | |
Timestamp (unsigned int year, Month month, unsigned int day, unsigned int hour, unsigned int minute, unsigned int second, unsigned int nanosecond) | |
Explicit timestamp initialization. More... | |
Timestamp (const Timestamp &other) | |
Initializes as copy of other instance. | |
unsigned int | year () const |
Year component of timestamp. | |
Month | month () const |
Month component of timestamp. | |
unsigned int | day () const |
Day component of timestamp. | |
unsigned int | hour () const |
Hour component of timestamp. | |
unsigned int | minute () const |
Minute component of timestamp. | |
unsigned int | second () const |
Second component of timestamp. | |
unsigned int | millisecond () const |
Millisecond component of timestamp. | |
unsigned int | microsecond () const |
Microsecond component of timestamp. | |
unsigned int | nanosecond () const |
Nanosecond component of timestamp. | |
Timestamp | date () const |
Returns timestamp without time part. | |
void | date (Date &) const |
Returns date component of timestamp. | |
TimeSpan | time () const |
Return time part of timestamp. | |
DayOfWeek | dayOfWeek () const |
Returns day of the week. | |
bool | operator== (const Timestamp &other) const |
Compares with other instance for equality. | |
bool | operator!= (const Timestamp &other) const |
Compares with other instance for inequality. | |
bool | operator< (const Timestamp &other) const |
Checks whether timestamp is less than other one. | |
bool | operator> (const Timestamp &other) const |
Checks whether timestamp is greater than other one. | |
Timestamp & | operator+= (const TimeSpan &span) |
Adds time interval to given timestamp. | |
Timestamp & | operator-= (const TimeSpan &span) |
Subtracts time interval from given timestamp. | |
Timestamp & | operator= (const Timestamp &other) |
Re-initializes as copy of other timestamp. | |
std::string | toString (TimestampFormat format=TimestampFormats::YYYYMMDDHHMMSSnsec) const |
Returns text presentation of timestamp using specified presentation format. More... | |
void | toString (std::string &str, TimestampFormat format=TimestampFormats::YYYYMMDDHHMMSSnsec) const |
Returns text presentation of timestamp using specified presentation format. More... | |
UInt64 | toUnixTimestamp () const |
Converts timestamp into its numeric presentation (Unix timestamp in nanoseconds since 01-01-1970 UTC). More... | |
Static Public Member Functions | |
static Timestamp | now () |
Return timestamp that is current date and time expressed as local time. More... | |
static void | now (Timestamp &) |
Return timestamp that is current date and time expressed as local time. More... | |
static Timestamp | utcNow () |
Return timestamp that is current date and time expressed as UTC time. More... | |
static void | utcNow (Timestamp &) |
Return timestamp that is current date and time expressed as UTC time. More... | |
static Timestamp | deserialize (const std::string &) |
De-serializes timestamp from text presentation. | |
static Timestamp | deserialize (unsigned long long presentation, TimestampFormat format) |
De-serializes timestamp from its numeric presentation as it's used by the CME Globex. More... | |
static Timestamp | fromUnixTimestamp (UInt64 sinceEpoch) |
Converts timestamp from its numeric presentation (Unix timestamp in nanoseconds since 01-01-1970 UTC). More... | |
Friends | |
ONIXS_CME_MD_API TimeSpan | operator- (const Timestamp &left, const Timestamp &right) |
Calculates time interval between two timestamps. | |
Represents timestamp without time-zone information.
Timestamp | ( | unsigned int | year, |
Month | month, | ||
unsigned int | day | ||
) |
Initializes as date with zero time component.
Input parameters are validated, therefore constructor throws exception if input values do not fit into their valid ranges.
Timestamp | ( | unsigned int | year, |
Month | month, | ||
unsigned int | day, | ||
unsigned int | hour, | ||
unsigned int | minute, | ||
unsigned int | second, | ||
unsigned int | nanosecond | ||
) |
Explicit timestamp initialization.
Input parameters are validated, therefore constructor throws exception if input values do not fit into their valid ranges.
|
static |
De-serializes timestamp from its numeric presentation as it's used by the CME Globex.
|
static |
Converts timestamp from its numeric presentation (Unix timestamp in nanoseconds since 01-01-1970 UTC).
|
static |
Return timestamp that is current date and time expressed as local time.
|
static |
Return timestamp that is current date and time expressed as local time.
|
inline |
Returns text presentation of timestamp using specified presentation format.
void toString | ( | std::string & | str, |
TimestampFormat | format = TimestampFormats::YYYYMMDDHHMMSSnsec |
||
) | const |
Returns text presentation of timestamp using specified presentation format.
UInt64 toUnixTimestamp | ( | ) | const |
Converts timestamp into its numeric presentation (Unix timestamp in nanoseconds since 01-01-1970 UTC).
|
static |
Return timestamp that is current date and time expressed as UTC time.
|
static |
Return timestamp that is current date and time expressed as UTC time.