|
Represents a point in time. More...
#include <ArmarXCore/core/time/DateTime.h>
Public Member Functions | |
ClockType | clockType () const |
DateTime () | |
DateTime (const IceUtil::Time &ice) | |
DateTime (Duration timeSinceEpoch, ClockType clock=ClockType::Virtual, const std::string &hostname="unknown") | |
DateTime (std::int64_t microSecondsSinceEpoch, ClockType clock=ClockType::Virtual, const std::string &hostname="unknown") | |
std::string | hostname () const |
bool | isInvalid () const |
bool | isValid () const |
operator IceUtil::Time () const | |
bool | operator!= (const DateTime &rhs) const |
DateTime | operator+ (const Duration &rhs) const |
DateTime & | operator+= (const Duration &rhs) |
Duration | operator- (const DateTime &rhs) const |
DateTime | operator- (const Duration &rhs) const |
DateTime & | operator-= (const Duration &rhs) |
bool | operator< (const DateTime &rhs) const |
bool | operator<= (const DateTime &rhs) const |
bool | operator== (const DateTime &rhs) const |
bool | operator> (const DateTime &rhs) const |
bool | operator>= (const DateTime &rhs) const |
std::string | toDateString () const |
std::string | toDateTimeString () const |
Duration | toDurationSinceEpoch () const |
std::int64_t | toMicroSeconds () const |
std::int64_t | toMicroSecondsSinceEpoch () const |
std::int64_t | toMilliSecondsSinceEpoch () const |
std::int64_t | toSecondsSinceEpoch () const |
std::string | toString (const std::string &format) const |
String representation of current date time according to given format string. More... | |
std::string | toTimeString () const |
Static Public Member Functions | |
static DateTime | Invalid () |
static DateTime | microSeconds (long microSeconds) |
static DateTime | Now () |
static DateTime | now () |
Protected Attributes | |
ClockType | _clockType |
std::string | _hostname |
Duration | _timeSinceEpoch |
Static Protected Attributes | |
static const Duration | _invalidTimeSinceEpoch = Duration::MicroSeconds(std::numeric_limits<long>::min()) |
Represents a point in time.
API and implementation to match IceUtil::Time (where applicable).
Definition at line 24 of file DateTime.h.
DateTime | ( | ) |
DateTime | ( | Duration | timeSinceEpoch, |
ClockType | clock = ClockType::Virtual , |
||
const std::string & | hostname = "unknown" |
||
) |
Definition at line 24 of file DateTime.cpp.
DateTime | ( | std::int64_t | microSecondsSinceEpoch, |
ClockType | clock = ClockType::Virtual , |
||
const std::string & | hostname = "unknown" |
||
) |
DateTime | ( | const IceUtil::Time & | ice | ) |
ClockType clockType | ( | ) | const |
Definition at line 123 of file DateTime.cpp.
std::string hostname | ( | ) | const |
Definition at line 130 of file DateTime.cpp.
|
static |
Definition at line 60 of file DateTime.cpp.
bool isInvalid | ( | ) | const |
Definition at line 140 of file DateTime.cpp.
bool isValid | ( | ) | const |
|
inlinestatic |
Definition at line 91 of file DateTime.h.
|
static |
|
inlinestatic |
operator IceUtil::Time | ( | ) | const |
bool operator!= | ( | const DateTime & | rhs | ) | const |
Definition at line 154 of file DateTime.cpp.
Definition at line 169 of file DateTime.cpp.
bool operator< | ( | const DateTime & | rhs | ) | const |
bool operator<= | ( | const DateTime & | rhs | ) | const |
bool operator== | ( | const DateTime & | rhs | ) | const |
bool operator> | ( | const DateTime & | rhs | ) | const |
bool operator>= | ( | const DateTime & | rhs | ) | const |
std::string toDateString | ( | ) | const |
Definition at line 67 of file DateTime.cpp.
std::string toDateTimeString | ( | ) | const |
Definition at line 81 of file DateTime.cpp.
Duration toDurationSinceEpoch | ( | ) | const |
|
inline |
Definition at line 97 of file DateTime.h.
std::int64_t toMicroSecondsSinceEpoch | ( | ) | const |
Definition at line 95 of file DateTime.cpp.
std::int64_t toMilliSecondsSinceEpoch | ( | ) | const |
Definition at line 102 of file DateTime.cpp.
std::int64_t toSecondsSinceEpoch | ( | ) | const |
Definition at line 109 of file DateTime.cpp.
std::string toString | ( | const std::string & | format | ) | const |
String representation of current date time according to given format string.
The format is according to https://en.cppreference.com/w/cpp/chrono/c/strftime. For milli seconds and micro seconds, special specifiers "%%msec" and "%%usec" were added respectively.
Example format string for "2022-03-04_16-59-10.981789": "%Y-%m-%d_%H-%M-%S.%%usec".
format | Format string. |
Definition at line 88 of file DateTime.cpp.
std::string toTimeString | ( | ) | const |
Definition at line 74 of file DateTime.cpp.
|
protected |
Definition at line 132 of file DateTime.h.
|
protected |
Definition at line 134 of file DateTime.h.
|
staticprotected |
Definition at line 128 of file DateTime.h.
|
protected |
Definition at line 130 of file DateTime.h.