#include <Timestamp.h>
Public Types | |
typedef Int64 | TimeDiff |
monotonic UTC time value in 100 nanosecond resolution | |
typedef Int64 | TimeVal |
typedef Int64 | UtcTimeVal |
monotonic UTC time value in microsecond resolution | |
Public Member Functions | |
TimeDiff | elapsed () const |
TimeVal | epochMicroseconds () const |
std::time_t | epochTime () const |
bool | isElapsed (TimeDiff interval) const |
bool | operator!= (const Timestamp &ts) const |
Timestamp | operator+ (TimeDiff d) const |
Timestamp & | operator+= (TimeDiff d) |
Timestamp | operator- (TimeDiff d) const |
TimeDiff | operator- (const Timestamp &ts) const |
Timestamp & | operator-= (TimeDiff d) |
bool | operator< (const Timestamp &ts) const |
bool | operator<= (const Timestamp &ts) const |
Timestamp & | operator= (const Timestamp &other) |
Destroys the timestamp. | |
Timestamp & | operator= (TimeVal tv) |
bool | operator== (const Timestamp &ts) const |
Updates the Timestamp with the current time. | |
bool | operator> (const Timestamp &ts) const |
bool | operator>= (const Timestamp &ts) const |
void | swap (Timestamp ×tamp) |
Timestamp () | |
difference between two timestamps in microseconds | |
Timestamp (TimeVal tv) | |
Creates a timestamp with the current time. | |
Timestamp (const Timestamp &other) | |
Creates a timestamp from the given time value. | |
void | update () |
Swaps the Timestamp with another one. | |
UtcTimeVal | utcTime () const |
~Timestamp () | |
Copy constructor. | |
Static Public Member Functions | |
static Timestamp | fromEpochTime (std::time_t t) |
static Timestamp | fromUtcTime (UtcTimeVal val) |
Creates a timestamp from a std::time_t. | |
static TimeVal | resolution () |
Creates a timestamp from a UTC time value. | |
Private Attributes | |
TimeVal | _ts |
A Timestamp stores a monotonic time value with (theoretical) microseconds resolution. Timestamps can be compared with each other and simple arithmetics are supported. Timestamps are UTC (Coordinated Universal Time) based and thus independent of the timezone in effect on the system.
Definition at line 50 of file Timestamp.h.
typedef Int64 Poco::Timestamp::TimeDiff |
monotonic UTC time value in 100 nanosecond resolution
Definition at line 62 of file Timestamp.h.
typedef Int64 Poco::Timestamp::TimeVal |
Definition at line 60 of file Timestamp.h.
typedef Int64 Poco::Timestamp::UtcTimeVal |
monotonic UTC time value in microsecond resolution
Definition at line 61 of file Timestamp.h.
difference between two timestamps in microseconds
Definition at line 53 of file Timestamp.cpp.
Creates a timestamp with the current time.
Definition at line 59 of file Timestamp.cpp.
Poco::Timestamp::Timestamp | ( | const Timestamp & | other | ) |
Creates a timestamp from the given time value.
Definition at line 65 of file Timestamp.cpp.
Copy constructor.
Definition at line 71 of file Timestamp.cpp.
Timestamp::TimeDiff Poco::Timestamp::elapsed | ( | ) | const [inline] |
Returns the timestamp expressed in microseconds since the Unix epoch, midnight, January 1, 1970.
Definition at line 230 of file Timestamp.h.
Timestamp::TimeVal Poco::Timestamp::epochMicroseconds | ( | ) | const [inline] |
Returns the timestamp expressed in UTC-based time. UTC base time is midnight, October 15, 1582. Resolution is 100 nanoseconds.
Definition at line 224 of file Timestamp.h.
std::time_t Poco::Timestamp::epochTime | ( | ) | const [inline] |
Definition at line 212 of file Timestamp.h.
Timestamp Poco::Timestamp::fromEpochTime | ( | std::time_t | t | ) | [static] |
Returns true iff the given interval has passed since the time denoted by the timestamp.
Definition at line 96 of file Timestamp.cpp.
Timestamp Poco::Timestamp::fromUtcTime | ( | UtcTimeVal | val | ) | [static] |
Creates a timestamp from a std::time_t.
Definition at line 102 of file Timestamp.cpp.
bool Poco::Timestamp::isElapsed | ( | Timestamp::TimeDiff | interval | ) | const [inline] |
Returns the time elapsed since the time denoted by the timestamp. Equivalent to Timestamp() - *this.
Definition at line 237 of file Timestamp.h.
bool Poco::Timestamp::operator!= | ( | const Timestamp & | ts | ) | const [inline] |
Definition at line 150 of file Timestamp.h.
Timestamp Poco::Timestamp::operator+ | ( | Timestamp::TimeDiff | d | ) | const [inline] |
Definition at line 180 of file Timestamp.h.
Timestamp & Poco::Timestamp::operator+= | ( | Timestamp::TimeDiff | d | ) | [inline] |
Definition at line 198 of file Timestamp.h.
Timestamp Poco::Timestamp::operator- | ( | Timestamp::TimeDiff | d | ) | const [inline] |
Definition at line 186 of file Timestamp.h.
Timestamp::TimeDiff Poco::Timestamp::operator- | ( | const Timestamp & | ts | ) | const [inline] |
Definition at line 192 of file Timestamp.h.
Timestamp & Poco::Timestamp::operator-= | ( | Timestamp::TimeDiff | d | ) | [inline] |
Definition at line 205 of file Timestamp.h.
bool Poco::Timestamp::operator< | ( | const Timestamp & | ts | ) | const [inline] |
Definition at line 168 of file Timestamp.h.
bool Poco::Timestamp::operator<= | ( | const Timestamp & | ts | ) | const [inline] |
Definition at line 174 of file Timestamp.h.
Destroys the timestamp.
Definition at line 76 of file Timestamp.cpp.
Definition at line 83 of file Timestamp.cpp.
bool Poco::Timestamp::operator== | ( | const Timestamp & | ts | ) | const [inline] |
Updates the Timestamp with the current time.
Definition at line 144 of file Timestamp.h.
bool Poco::Timestamp::operator> | ( | const Timestamp & | ts | ) | const [inline] |
Definition at line 156 of file Timestamp.h.
bool Poco::Timestamp::operator>= | ( | const Timestamp & | ts | ) | const [inline] |
Definition at line 162 of file Timestamp.h.
Timestamp::TimeVal Poco::Timestamp::resolution | ( | ) | [inline, static] |
Creates a timestamp from a UTC time value.
Definition at line 245 of file Timestamp.h.
void Poco::Timestamp::swap | ( | Timestamp & | timestamp | ) |
Definition at line 90 of file Timestamp.cpp.
void Poco::Timestamp::update | ( | ) |
Swaps the Timestamp with another one.
Definition at line 110 of file Timestamp.cpp.
Timestamp::UtcTimeVal Poco::Timestamp::utcTime | ( | ) | const [inline] |
Returns the timestamp expressed in time_t. time_t base time is midnight, January 1, 1970. Resolution is one second.
Definition at line 218 of file Timestamp.h.
TimeVal Poco::Timestamp::_ts [private] |
Returns the resolution in units per second. Since the timestamp has microsecond resolution, the returned value is always 1000000.
Definition at line 137 of file Timestamp.h.