Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::Timestamp Class Reference

#include <Timestamp.h>

Public Types

using TimeVal = Int64
 
using UtcTimeVal = Int64
 
using TimeDiff = Int64
 

Public Member Functions

 Timestamp ()
 Maximum timestamp value.
 
 Timestamp (TimeVal tv)
 Creates a timestamp with the current time.
 
 Timestamp (const Timestamp &other)
 
 ~Timestamp ()
 Copy constructor.
 
Timestampoperator= (const Timestamp &other)
 Destroys the timestamp.
 
Timestampoperator= (TimeVal tv)
 
void swap (Timestamp &timestamp)
 
void update ()
 Swaps the Timestamp with another one.
 
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
 
bool operator>= (const Timestamp &ts) const
 
bool operator< (const Timestamp &ts) const
 
bool operator<= (const Timestamp &ts) const
 
Timestamp operator+ (TimeDiff d) const
 
Timestamp operator+ (const Timespan &span) const
 
Timestamp operator- (TimeDiff d) const
 
Timestamp operator- (const Timespan &span) const
 
TimeDiff operator- (const Timestamp &ts) const
 
Timestampoperator+= (TimeDiff d)
 
Timestampoperator+= (const Timespan &span)
 
Timestampoperator-= (TimeDiff d)
 
Timestampoperator-= (const Timespan &span)
 
std::time_t epochTime () const
 
UtcTimeVal utcTime () const
 
TimeVal epochMicroseconds () const
 
TimeDiff elapsed () const
 
bool isElapsed (TimeDiff interval) const
 
TimeVal raw () const
 

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 TimeDiff resolution ()
 

Static Public Attributes

static const TimeVal TIMEVAL_MIN
 Difference between two TimeVal values in microseconds.
 
static const TimeVal TIMEVAL_MAX
 Minimum timestamp value.
 

Private Attributes

TimeVal _ts
 

Detailed Description

A Timestamp stores a monotonic* time value with (theoretical) microseconds resolution. Timestamps can be compared with each other and simple arithmetic is supported.

[*] Note that Timestamp values are only monotonic as long as the systems's clock is monotonic as well (and not, e.g. set back due to time synchronization or other reasons).

Timestamps are UTC (Coordinated Universal Time) based and thus independent of the timezone in effect on the system.

The internal reference time is the Unix epoch, midnight, January 1, 1970.

Definition at line 31 of file Timestamp.h.

Member Typedef Documentation

◆ TimeDiff

Monotonic UTC time value in 100 nanosecond resolution, with base time midnight, October 15, 1582.

Definition at line 58 of file Timestamp.h.

◆ TimeVal

Definition at line 50 of file Timestamp.h.

◆ UtcTimeVal

Monotonic UTC time value in microsecond resolution, with base time midnight, January 1, 1970.

Definition at line 54 of file Timestamp.h.

Constructor & Destructor Documentation

◆ Timestamp() [1/3]

Poco::Timestamp::Timestamp ( )

Maximum timestamp value.

◆ Timestamp() [2/3]

Poco::Timestamp::Timestamp ( TimeVal tv)

Creates a timestamp with the current time.

+ Here is the caller graph for this function:

◆ Timestamp() [3/3]

Poco::Timestamp::Timestamp ( const Timestamp & other)

Creates a timestamp from the given time value (microseconds since midnight, January 1, 1970).

◆ ~Timestamp()

Poco::Timestamp::~Timestamp ( )

Copy constructor.

Member Function Documentation

◆ elapsed()

Timestamp::TimeDiff Poco::Timestamp::elapsed ( ) const
inline

Returns the timestamp expressed in microseconds since the Unix epoch, midnight, January 1, 1970.

Definition at line 242 of file Timestamp.h.

+ Here is the call graph for this function:

◆ epochMicroseconds()

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 236 of file Timestamp.h.

◆ epochTime()

std::time_t Poco::Timestamp::epochTime ( ) const
inline

Definition at line 224 of file Timestamp.h.

+ Here is the call graph for this function:

◆ fromEpochTime()

static Timestamp Poco::Timestamp::fromEpochTime ( std::time_t t)
static

Returns the raw time value.

Same as epochMicroseconds().

◆ fromUtcTime()

static Timestamp Poco::Timestamp::fromUtcTime ( UtcTimeVal val)
static

Creates a timestamp from a std::time_t.

+ Here is the caller graph for this function:

◆ isElapsed()

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 249 of file Timestamp.h.

+ Here is the call graph for this function:

◆ operator!=()

bool Poco::Timestamp::operator!= ( const Timestamp & ts) const
inline

Definition at line 162 of file Timestamp.h.

◆ operator+() [1/2]

Timestamp Poco::Timestamp::operator+ ( const Timespan & span) const

◆ operator+() [2/2]

Timestamp Poco::Timestamp::operator+ ( Timestamp::TimeDiff d) const
inline

Definition at line 192 of file Timestamp.h.

+ Here is the call graph for this function:

◆ operator+=() [1/2]

Timestamp & Poco::Timestamp::operator+= ( const Timespan & span)

◆ operator+=() [2/2]

Timestamp & Poco::Timestamp::operator+= ( Timestamp::TimeDiff d)
inline

Definition at line 210 of file Timestamp.h.

◆ operator-() [1/3]

Timestamp Poco::Timestamp::operator- ( const Timespan & span) const

◆ operator-() [2/3]

Timestamp::TimeDiff Poco::Timestamp::operator- ( const Timestamp & ts) const
inline

Definition at line 204 of file Timestamp.h.

+ Here is the caller graph for this function:

◆ operator-() [3/3]

Timestamp Poco::Timestamp::operator- ( Timestamp::TimeDiff d) const
inline

Definition at line 198 of file Timestamp.h.

+ Here is the call graph for this function:

◆ operator-=() [1/2]

Timestamp & Poco::Timestamp::operator-= ( const Timespan & span)

◆ operator-=() [2/2]

Timestamp & Poco::Timestamp::operator-= ( Timestamp::TimeDiff d)
inline

Definition at line 217 of file Timestamp.h.

◆ operator<()

bool Poco::Timestamp::operator< ( const Timestamp & ts) const
inline

Definition at line 180 of file Timestamp.h.

◆ operator<=()

bool Poco::Timestamp::operator<= ( const Timestamp & ts) const
inline

Definition at line 186 of file Timestamp.h.

◆ operator=() [1/2]

Timestamp & Poco::Timestamp::operator= ( const Timestamp & other)

Destroys the timestamp.

◆ operator=() [2/2]

Timestamp & Poco::Timestamp::operator= ( TimeVal tv)

◆ operator==()

bool Poco::Timestamp::operator== ( const Timestamp & ts) const
inline

Updates the Timestamp with the current time.

Definition at line 156 of file Timestamp.h.

◆ operator>()

bool Poco::Timestamp::operator> ( const Timestamp & ts) const
inline

Definition at line 168 of file Timestamp.h.

◆ operator>=()

bool Poco::Timestamp::operator>= ( const Timestamp & ts) const
inline

Definition at line 174 of file Timestamp.h.

◆ raw()

Timestamp::TimeVal Poco::Timestamp::raw ( ) const
inline

Returns true iff the given interval has passed since the time denoted by the timestamp.

Definition at line 269 of file Timestamp.h.

◆ resolution()

Timestamp::TimeDiff Poco::Timestamp::resolution ( )
inlinestatic

Creates a timestamp from a UTC time value (100 nanosecond intervals since midnight, October 15, 1582).

Definition at line 257 of file Timestamp.h.

+ Here is the caller graph for this function:

◆ swap()

void Poco::Timestamp::swap ( Timestamp & timestamp)
+ Here is the caller graph for this function:

◆ update()

void Poco::Timestamp::update ( )

Swaps the Timestamp with another one.

◆ utcTime()

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 230 of file Timestamp.h.

Member Data Documentation

◆ _ts

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 149 of file Timestamp.h.

◆ TIMEVAL_MAX

const TimeVal Poco::Timestamp::TIMEVAL_MAX
static

Minimum timestamp value.

Definition at line 62 of file Timestamp.h.

◆ TIMEVAL_MIN

const TimeVal Poco::Timestamp::TIMEVAL_MIN
static

Difference between two TimeVal values in microseconds.

Definition at line 61 of file Timestamp.h.


The documentation for this class was generated from the following file: