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

A class that represents time spans up to microsecond resolution. More...

#include <Timespan.h>

Public Types

using TimeDiff = Timestamp::TimeDiff
 

Public Member Functions

 Timespan ()
 
 Timespan (TimeDiff microseconds)
 Creates a zero Timespan.
 
 Timespan (long seconds, long microseconds)
 Creates a Timespan.
 
 Timespan (int days, int hours, int minutes, int seconds, int microSeconds)
 
 Timespan (const Timespan &timespan)
 Creates a Timespan.
 
 ~Timespan ()
 Creates a Timespan from another one.
 
Timespanoperator= (const Timespan &timespan)
 Destroys the Timespan.
 
Timespanoperator= (TimeDiff microseconds)
 Assignment operator.
 
Timespanassign (int days, int hours, int minutes, int seconds, int microSeconds)
 Assignment operator.
 
Timespanassign (long seconds, long microseconds)
 Assigns a new span.
 
void swap (Timespan &timespan)
 
bool operator== (const Timespan &ts) const
 Swaps the Timespan with another one.
 
bool operator!= (const Timespan &ts) const
 
bool operator> (const Timespan &ts) const
 
bool operator>= (const Timespan &ts) const
 
bool operator< (const Timespan &ts) const
 
bool operator<= (const Timespan &ts) const
 
bool operator== (TimeDiff microSeconds) const
 
bool operator!= (TimeDiff microSeconds) const
 
bool operator> (TimeDiff microSeconds) const
 
bool operator>= (TimeDiff microSeconds) const
 
bool operator< (TimeDiff microSeconds) const
 
bool operator<= (TimeDiff microSeconds) const
 
Timespan operator+ (const Timespan &d) const
 
Timespan operator- (const Timespan &d) const
 
Timespanoperator+= (const Timespan &d)
 
Timespanoperator-= (const Timespan &d)
 
Timespan operator+ (TimeDiff microSeconds) const
 
Timespan operator- (TimeDiff microSeconds) const
 
Timespanoperator+= (TimeDiff microSeconds)
 
Timespanoperator-= (TimeDiff microSeconds)
 
int days () const
 
int hours () const
 Returns the number of days.
 
int totalHours () const
 Returns the number of hours (0 to 23).
 
int minutes () const
 Returns the total number of hours.
 
int totalMinutes () const
 Returns the number of minutes (0 to 59).
 
int seconds () const
 Returns the total number of minutes.
 
int totalSeconds () const
 Returns the number of seconds (0 to 59).
 
int milliseconds () const
 Returns the total number of seconds.
 
TimeDiff totalMilliseconds () const
 Returns the number of milliseconds (0 to 999).
 
int microseconds () const
 Returns the total number of milliseconds.
 
int useconds () const
 
TimeDiff totalMicroseconds () const
 

Static Public Attributes

static const TimeDiff MILLISECONDS
 Returns the total number of microseconds.
 
static const TimeDiff SECONDS
 The number of microseconds in a millisecond.
 
static const TimeDiff MINUTES
 The number of microseconds in a second.
 
static const TimeDiff HOURS
 The number of microseconds in a minute.
 
static const TimeDiff DAYS
 The number of microseconds in a hour.
 

Private Attributes

TimeDiff _span
 The number of microseconds in a day.
 

Detailed Description

A class that represents time spans up to microsecond resolution.

Definition at line 28 of file Timespan.h.

Member Typedef Documentation

◆ TimeDiff

Definition at line 32 of file Timespan.h.

Constructor & Destructor Documentation

◆ Timespan() [1/5]

Poco::Timespan::Timespan ( )

◆ Timespan() [2/5]

Poco::Timespan::Timespan ( TimeDiff microseconds)

Creates a zero Timespan.

◆ Timespan() [3/5]

Poco::Timespan::Timespan ( long seconds,
long microseconds )

Creates a Timespan.

◆ Timespan() [4/5]

Poco::Timespan::Timespan ( int days,
int hours,
int minutes,
int seconds,
int microSeconds )

Creates a Timespan. Useful for creating a Timespan from a struct timeval.

◆ Timespan() [5/5]

Poco::Timespan::Timespan ( const Timespan & timespan)

Creates a Timespan.

◆ ~Timespan()

Poco::Timespan::~Timespan ( )
inline

Creates a Timespan from another one.

Definition at line 295 of file Timespan.h.

Member Function Documentation

◆ assign() [1/2]

Timespan & Poco::Timespan::assign ( int days,
int hours,
int minutes,
int seconds,
int microSeconds )

Assignment operator.

◆ assign() [2/2]

Timespan & Poco::Timespan::assign ( long seconds,
long microseconds )

Assigns a new span.

◆ days()

int Poco::Timespan::days ( ) const
inline

Definition at line 145 of file Timespan.h.

◆ hours()

int Poco::Timespan::hours ( ) const
inline

Returns the number of days.

Definition at line 151 of file Timespan.h.

◆ microseconds()

int Poco::Timespan::microseconds ( ) const
inline

Returns the total number of milliseconds.

Definition at line 199 of file Timespan.h.

◆ milliseconds()

int Poco::Timespan::milliseconds ( ) const
inline

Returns the total number of seconds.

Definition at line 187 of file Timespan.h.

◆ minutes()

int Poco::Timespan::minutes ( ) const
inline

Returns the total number of hours.

Definition at line 163 of file Timespan.h.

◆ operator!=() [1/2]

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

Definition at line 223 of file Timespan.h.

◆ operator!=() [2/2]

bool Poco::Timespan::operator!= ( TimeDiff microSeconds) const
inline

Definition at line 259 of file Timespan.h.

◆ operator+() [1/2]

Timespan Poco::Timespan::operator+ ( const Timespan & d) const

◆ operator+() [2/2]

Timespan Poco::Timespan::operator+ ( TimeDiff microSeconds) const

◆ operator+=() [1/2]

Timespan & Poco::Timespan::operator+= ( const Timespan & d)

◆ operator+=() [2/2]

Timespan & Poco::Timespan::operator+= ( TimeDiff microSeconds)

◆ operator-() [1/2]

Timespan Poco::Timespan::operator- ( const Timespan & d) const

◆ operator-() [2/2]

Timespan Poco::Timespan::operator- ( TimeDiff microSeconds) const

◆ operator-=() [1/2]

Timespan & Poco::Timespan::operator-= ( const Timespan & d)

◆ operator-=() [2/2]

Timespan & Poco::Timespan::operator-= ( TimeDiff microSeconds)

◆ operator<() [1/2]

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

Definition at line 241 of file Timespan.h.

◆ operator<() [2/2]

bool Poco::Timespan::operator< ( TimeDiff microSeconds) const
inline

Definition at line 277 of file Timespan.h.

◆ operator<=() [1/2]

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

Definition at line 247 of file Timespan.h.

◆ operator<=() [2/2]

bool Poco::Timespan::operator<= ( TimeDiff microSeconds) const
inline

Definition at line 283 of file Timespan.h.

◆ operator=() [1/2]

Timespan & Poco::Timespan::operator= ( const Timespan & timespan)

Destroys the Timespan.

◆ operator=() [2/2]

Timespan & Poco::Timespan::operator= ( TimeDiff microseconds)

Assignment operator.

◆ operator==() [1/2]

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

Swaps the Timespan with another one.

Definition at line 217 of file Timespan.h.

◆ operator==() [2/2]

bool Poco::Timespan::operator== ( TimeDiff microSeconds) const
inline

Definition at line 253 of file Timespan.h.

◆ operator>() [1/2]

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

Definition at line 229 of file Timespan.h.

◆ operator>() [2/2]

bool Poco::Timespan::operator> ( TimeDiff microSeconds) const
inline

Definition at line 265 of file Timespan.h.

◆ operator>=() [1/2]

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

Definition at line 235 of file Timespan.h.

◆ operator>=() [2/2]

bool Poco::Timespan::operator>= ( TimeDiff microSeconds) const
inline

Definition at line 271 of file Timespan.h.

◆ seconds()

int Poco::Timespan::seconds ( ) const
inline

Returns the total number of minutes.

Definition at line 175 of file Timespan.h.

◆ swap()

void Poco::Timespan::swap ( Timespan & timespan)

Assigns a new span. Useful for assigning from a struct timeval.

+ Here is the caller graph for this function:

◆ totalHours()

int Poco::Timespan::totalHours ( ) const
inline

Returns the number of hours (0 to 23).

Definition at line 157 of file Timespan.h.

◆ totalMicroseconds()

Timespan::TimeDiff Poco::Timespan::totalMicroseconds ( ) const
inline

Returns the fractions of a second in microseconds (0 to 999999).

Definition at line 211 of file Timespan.h.

◆ totalMilliseconds()

Timespan::TimeDiff Poco::Timespan::totalMilliseconds ( ) const
inline

Returns the number of milliseconds (0 to 999).

Definition at line 193 of file Timespan.h.

◆ totalMinutes()

int Poco::Timespan::totalMinutes ( ) const
inline

Returns the number of minutes (0 to 59).

Definition at line 169 of file Timespan.h.

◆ totalSeconds()

int Poco::Timespan::totalSeconds ( ) const
inline

Returns the number of seconds (0 to 59).

Definition at line 181 of file Timespan.h.

◆ useconds()

int Poco::Timespan::useconds ( ) const
inline

Returns the fractions of a millisecond in microseconds (0 to 999).

Definition at line 205 of file Timespan.h.

Member Data Documentation

◆ _span

TimeDiff Poco::Timespan::_span
private

The number of microseconds in a day.

Definition at line 138 of file Timespan.h.

◆ DAYS

const TimeDiff Poco::Timespan::DAYS
static

The number of microseconds in a hour.

Definition at line 135 of file Timespan.h.

◆ HOURS

const TimeDiff Poco::Timespan::HOURS
static

The number of microseconds in a minute.

Definition at line 134 of file Timespan.h.

◆ MILLISECONDS

const TimeDiff Poco::Timespan::MILLISECONDS
static

Returns the total number of microseconds.

Definition at line 131 of file Timespan.h.

◆ MINUTES

const TimeDiff Poco::Timespan::MINUTES
static

The number of microseconds in a second.

Definition at line 133 of file Timespan.h.

◆ SECONDS

const TimeDiff Poco::Timespan::SECONDS
static

The number of microseconds in a millisecond.

Definition at line 132 of file Timespan.h.


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