E-MailRelay
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
G::TimerTime Class Reference

A monotonically increasing subsecond-resolution timestamp, notionally unrelated to time_t. More...

#include <gdatetime.h>

Public Types

using time_point_type = std::chrono::time_point< std::chrono::steady_clock >
 

Public Member Functions

bool isZero () const noexcept
 Returns true if zero(). More...
 
bool sameSecond (const TimerTime &other) const
 Returns true if this time and the other time are the same, at second resolution. More...
 
bool operator<= (const TimerTime &) const
 Comparison operator. More...
 
bool operator== (const TimerTime &) const
 Comparison operator. More...
 
bool operator!= (const TimerTime &) const
 Comparison operator. More...
 
bool operator> (const TimerTime &) const
 Comparison operator. More...
 
bool operator>= (const TimerTime &) const
 Comparison operator. More...
 
TimerTime operator+ (const TimeInterval &) const
 Returns this time with given interval added. More...
 
void operator+= (TimeInterval)
 Adds an interval. More...
 
TimeInterval operator- (const TimerTime &start) const
 Returns the given start time's interval() compared to this end time. More...
 
TimeInterval interval (const TimerTime &end) const
 Returns the interval between this time and the given end time. More...
 

Static Public Member Functions

static TimerTime now ()
 Factory function for the current steady-clock time. More...
 
static TimerTime zero ()
 Factory function for the start of the epoch, guaranteed to be less than any now(). More...
 
static bool less (const TimerTime &, const TimerTime &) noexcept(less_noexcept)
 Comparison operator. More...
 

Static Public Attributes

static constexpr bool less_noexcept = noexcept(time_point_type() < time_point_type())
 

Friends

class G::DateTimeTest
 

Detailed Description

A monotonically increasing subsecond-resolution timestamp, notionally unrelated to time_t.

Definition at line 230 of file gdatetime.h.

Member Typedef Documentation

◆ time_point_type

using G::TimerTime::time_point_type = std::chrono::time_point<std::chrono::steady_clock>

Definition at line 233 of file gdatetime.h.

Member Function Documentation

◆ interval()

G::TimeInterval G::TimerTime::interval ( const TimerTime end) const

Returns the interval between this time and the given end time.

Returns TimeInterval::zero() on underflow or TimeInterval::limit() if the TimeInterval::s_type value overflows.

Definition at line 546 of file gdatetime.cpp.

◆ isZero()

bool G::TimerTime::isZero ( ) const
noexcept

Returns true if zero().

Definition at line 491 of file gdatetime.cpp.

◆ less()

bool G::TimerTime::less ( const TimerTime a,
const TimerTime b 
)
inlinestaticnoexcept

Comparison operator.

Definition at line 412 of file gdatetime.h.

◆ now()

G::TimerTime G::TimerTime::now ( )
static

Factory function for the current steady-clock time.

Definition at line 479 of file gdatetime.cpp.

◆ operator!=()

bool G::TimerTime::operator!= ( const TimerTime other) const

Comparison operator.

Definition at line 572 of file gdatetime.cpp.

◆ operator+()

G::TimerTime G::TimerTime::operator+ ( const TimeInterval interval) const

Returns this time with given interval added.

Definition at line 525 of file gdatetime.cpp.

◆ operator+=()

void G::TimerTime::operator+= ( TimeInterval  i)

Adds an interval.

Definition at line 532 of file gdatetime.cpp.

◆ operator-()

G::TimeInterval G::TimerTime::operator- ( const TimerTime start) const

Returns the given start time's interval() compared to this end time.

Returns TimeInterval::zero() on underflow or TimeInterval::limit() if the TimeInterval::s_type value overflows.

Definition at line 540 of file gdatetime.cpp.

◆ operator<=()

bool G::TimerTime::operator<= ( const TimerTime other) const

Comparison operator.

Definition at line 561 of file gdatetime.cpp.

◆ operator==()

bool G::TimerTime::operator== ( const TimerTime other) const

Comparison operator.

Definition at line 566 of file gdatetime.cpp.

◆ operator>()

bool G::TimerTime::operator> ( const TimerTime other) const

Comparison operator.

Definition at line 579 of file gdatetime.cpp.

◆ operator>=()

bool G::TimerTime::operator>= ( const TimerTime other) const

Comparison operator.

Definition at line 586 of file gdatetime.cpp.

◆ sameSecond()

bool G::TimerTime::sameSecond ( const TimerTime other) const

Returns true if this time and the other time are the same, at second resolution.

Definition at line 552 of file gdatetime.cpp.

◆ zero()

G::TimerTime G::TimerTime::zero ( )
static

Factory function for the start of the epoch, guaranteed to be less than any now().

Definition at line 486 of file gdatetime.cpp.

Friends And Related Function Documentation

◆ G::DateTimeTest

friend class G::DateTimeTest
friend

Definition at line 288 of file gdatetime.h.

Member Data Documentation

◆ less_noexcept

constexpr bool G::TimerTime::less_noexcept = noexcept(time_point_type() < time_point_type())
staticconstexpr

Definition at line 249 of file gdatetime.h.


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