![]() |
ezEngine Release 25.08
|
The timestamp class encapsulates a date in time as microseconds since Unix epoch. More...
#include <Timestamp.h>
Classes | |
| struct | CompareMode |
Public Member Functions | |
| EZ_DECLARE_POD_TYPE () | |
| ezTimestamp () | |
| Creates an invalidated timestamp. | |
| bool | IsValid () const |
| Returns whether the timestamp is valid. | |
| ezInt64 | GetInt64 (ezSIUnitOfTime::Enum unitOfTime) const |
| Returns the number of 'unitOfTime' since Unix epoch. | |
| bool | Compare (const ezTimestamp &rhs, CompareMode::Enum mode) const |
| Returns whether this timestamp is considered equal to 'rhs' in the given mode. | |
| void | operator+= (const ezTime &timeSpan) |
| Adds the time value of "timeSpan" to this data value. | |
| void | operator-= (const ezTime &timeSpan) |
| Subtracts the time value of "timeSpan" from this date value. | |
| const ezTime | operator- (const ezTimestamp &other) const |
| Returns the time span between this timestamp and "other". | |
| const ezTimestamp | operator+ (const ezTime &timeSpan) const |
| Returns a timestamp that is "timeSpan" further into the future from this timestamp. | |
| const ezTimestamp | operator- (const ezTime &timeSpan) const |
| Returns a timestamp that is "timeSpan" further into the past from this timestamp. | |
Static Public Member Functions | |
| static const ezTimestamp | CurrentTimestamp () |
| Returns the current timestamp. Returned value will always be valid. | |
| static ezTimestamp | MakeInvalid () |
| Returns an invalid timestamp. | |
| static ezTimestamp | MakeFromInt (ezInt64 iTimeValue, ezSIUnitOfTime::Enum unitOfTime) |
| Returns a timestamp initialized from 'iTimeValue' in 'unitOfTime' since Unix epoch. | |
The timestamp class encapsulates a date in time as microseconds since Unix epoch.
The value is represented by an ezInt64 and allows storing time stamps from roughly -291030 BC to 293970 AC. Use this class to efficiently store a timestamp that is valid across platforms.
| bool ezTimestamp::Compare | ( | const ezTimestamp & | rhs, |
| CompareMode::Enum | mode | ||
| ) | const |
Returns whether this timestamp is considered equal to 'rhs' in the given mode.
Use CompareMode::FileTime when working with file time stamps across platforms. It will use the lowest resolution supported by all platforms to make sure the timestamp of a file is considered equal regardless on which platform it was retrieved.
|
static |
Returns the current timestamp. Returned value will always be valid.
Depending on the platform the precision varies between seconds and nanoseconds.