Represents timestamp without time-zone information. More...
Public Member Functions | |
Timestamp () | |
Initializes as Jan 1, 0001, 00:00:00. | |
Timestamp (unsigned int year, Month::Enum month, unsigned int day, unsigned int hour=0, unsigned int minute=0, unsigned int second=0, unsigned int nanosecond=0) | |
Initializes date-time from all details. | |
unsigned | year () const |
Year component of timestamp. | |
Month::Enum | month () const |
Month component of timestamp. | |
unsigned int | day () const |
day of month component of timestamp Valid values are 1 through 31. More... | |
void | date (YearMonthDay &) const |
Returns date part of timestamp. | |
unsigned int | hour () const |
Hour component of timestamp. More... | |
unsigned int | minute () const |
Minute component of timestamp Valid values are 0 through 59. More... | |
unsigned int | second () const |
Second component of timestamp Valid values are 0 through 59. More... | |
unsigned int | millisecond () const |
Millisecond component of timestamp Valid values are 0 through 999. More... | |
unsigned int | microsecond () const |
Microsecond component of timestamp Valid values are 0 through 999999. More... | |
unsigned int | nanosecond () const |
Nanosecond component of timestamp Valid values are 0 through 999999999. More... | |
const TimeSpan & | sinceEpoch () const |
Time span since Jan 1, 0001, 00:00:00. | |
bool | operator== (const Timestamp &) const |
Compares instance with another one. | |
bool | operator!= (const Timestamp &) const |
Compares instance with another one. | |
bool | operator< (const Timestamp &) const |
Tests whether instance is less than another one. | |
std::string | toString (TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const |
Returns timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default). More... | |
void | toString (std::string &str, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const |
Appends timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default). More... | |
Static Public Member Functions | |
static Timestamp | epoch () |
Epoch. | |
static Timestamp | utcNow () |
Returns the current UTC time. More... | |
static Timestamp | now () |
Returns the current local time. More... | |
static Timestamp | parse (const std::string &, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) |
Parses timestamp from its text presentation assuming it's in specified format ("YYYYMMDD-HH:MM:SS.sssssssss" by default). More... | |
static Timestamp | parse (const char *data, size_t size, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) |
static Timestamp | parse (unsigned long long presentation, TimestampFormat::Enum format) |
Parses timestamp from its numeric presentation. | |
Friends | |
class | TimeManager |
Represents timestamp without time-zone information.
unsigned int day | ( | ) | const |
day of month component of timestamp Valid values are 1 through 31.
unsigned int hour | ( | ) | const |
Hour component of timestamp.
Valid values are 0 through 23.
|
inline |
Microsecond component of timestamp Valid values are 0 through 999999.
|
inline |
Millisecond component of timestamp Valid values are 0 through 999.
unsigned int minute | ( | ) | const |
Minute component of timestamp Valid values are 0 through 59.
|
inline |
Nanosecond component of timestamp Valid values are 0 through 999999999.
|
static |
Returns the current local time.
|
static |
Parses timestamp from its text presentation assuming it's in specified format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).
unsigned int second | ( | ) | const |
Second component of timestamp Valid values are 0 through 59.
|
inline |
Returns timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).
void toString | ( | std::string & | str, |
TimestampFormat::Enum | = TimestampFormat::YYYYMMDDHHMMSSNsec |
||
) | const |
Appends timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).