A Timestamp stores a monotonic* time value with microseconds resolution. More...

#include <mn_timestamp.hpp>

Public Types

using time_type = MINILIB_TIMESTAMP_TIME_TYPE
 
using self_type = basic_timestamp
 

Public Member Functions

 basic_timestamp ()
 Consruct a basic_timestamp with the current time. More...
 
 basic_timestamp (time_type tv)
 Creates a timestamp from the given time value. More...
 
 basic_timestamp (const self_type &other)
 Copy constructor. More...
 
void update ()
 
void swap (self_type &time)
 
mn::time_t get_epoch () const
 
time_type get_utc () const
 Get the timestamp expressed in UTC-based time. More...
 
time_type get_microseconds () const
 Get the timestamp expressed in microseconds. More...
 
time_type get_elapsed () const
 Get the time elapsed since the time denoted by the timestamp. More...
 
bool is_elapsed (time_type interval) const
 if the given interval has passed since the time denoted by the timestamp. More...
 
bool operator== (const self_type &ts) const
 
bool operator!= (const self_type &ts) const
 
bool operator>= (const self_type &ts) const
 
bool operator<= (const self_type &ts) const
 
bool operator< (const self_type &ts) const
 
bool operator> (const self_type &ts) const
 
time_type operator- (const self_type &ts) const
 
time_type operator+ (const self_type &ts) const
 
self_type operator+ (time_type d) const
 
self_type operator- (time_type d) const
 
self_typeoperator+= (time_type d)
 
self_typeoperator-= (time_type d)
 
self_type operator+ (const basic_timespan &span) const
 
self_type operator- (const basic_timespan &span) const
 
self_typeoperator+= (const basic_timespan &span)
 
self_typeoperator-= (const basic_timespan &span)
 
self_typeoperator= (const self_type &other)
 
self_typeoperator= (time_type tv)
 

Static Public Member Functions

static self_type from_epoch (const mn::time_t t)
 Creates a timestamp from a mn::time_t. More...
 
static self_type from_utc (const time_type val)
 Creates a timestamp from a UTC time value. More...
 

Private Attributes

time_type m_time
 

Detailed Description

A Timestamp stores a monotonic* time value with microseconds resolution.

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

Member Typedef Documentation

◆ self_type

◆ time_type

Constructor & Destructor Documentation

◆ basic_timestamp() [1/3]

mn::basic_timestamp::basic_timestamp ( )

Consruct a basic_timestamp with the current time.

◆ basic_timestamp() [2/3]

mn::basic_timestamp::basic_timestamp ( time_type  tv)

Creates a timestamp from the given time value.

◆ basic_timestamp() [3/3]

mn::basic_timestamp::basic_timestamp ( const self_type other)

Copy constructor.

Member Function Documentation

◆ from_epoch()

basic_timestamp::self_type mn::basic_timestamp::from_epoch ( const mn::time_t  t)
static

Creates a timestamp from a mn::time_t.

◆ from_utc()

basic_timestamp::self_type mn::basic_timestamp::from_utc ( const time_type  val)
static

Creates a timestamp from a UTC time value.

Note
since midnight 15 October 1582.

◆ get_elapsed()

time_type mn::basic_timestamp::get_elapsed ( ) const
inline

Get the time elapsed since the time denoted by the timestamp.

Note
Equivalent to Timestamp() - *this.

◆ get_epoch()

mn::time_t mn::basic_timestamp::get_epoch ( ) const
inline

◆ get_microseconds()

time_type mn::basic_timestamp::get_microseconds ( ) const
inline

Get the timestamp expressed in microseconds.

Note
Unix epoch, midnight, January 1, 1970.

◆ get_utc()

time_type mn::basic_timestamp::get_utc ( ) const
inline

Get the timestamp expressed in UTC-based time.

◆ is_elapsed()

bool mn::basic_timestamp::is_elapsed ( time_type  interval) const
inline

if the given interval has passed since the time denoted by the timestamp.

◆ operator!=()

bool mn::basic_timestamp::operator!= ( const self_type ts) const
inline

◆ operator+() [1/3]

self_type mn::basic_timestamp::operator+ ( const basic_timespan span) const
inline

◆ operator+() [2/3]

time_type mn::basic_timestamp::operator+ ( const self_type ts) const
inline

◆ operator+() [3/3]

self_type mn::basic_timestamp::operator+ ( time_type  d) const
inline

◆ operator+=() [1/2]

self_type& mn::basic_timestamp::operator+= ( const basic_timespan span)
inline

◆ operator+=() [2/2]

self_type& mn::basic_timestamp::operator+= ( time_type  d)
inline

◆ operator-() [1/3]

self_type mn::basic_timestamp::operator- ( const basic_timespan span) const
inline

◆ operator-() [2/3]

time_type mn::basic_timestamp::operator- ( const self_type ts) const
inline

◆ operator-() [3/3]

self_type mn::basic_timestamp::operator- ( time_type  d) const
inline

◆ operator-=() [1/2]

self_type& mn::basic_timestamp::operator-= ( const basic_timespan span)
inline

◆ operator-=() [2/2]

self_type& mn::basic_timestamp::operator-= ( time_type  d)
inline

◆ operator<()

bool mn::basic_timestamp::operator< ( const self_type ts) const
inline

◆ operator<=()

bool mn::basic_timestamp::operator<= ( const self_type ts) const
inline

◆ operator=() [1/2]

self_type& mn::basic_timestamp::operator= ( const self_type other)
inline

◆ operator=() [2/2]

self_type& mn::basic_timestamp::operator= ( time_type  tv)
inline

◆ operator==()

bool mn::basic_timestamp::operator== ( const self_type ts) const
inline

◆ operator>()

bool mn::basic_timestamp::operator> ( const self_type ts) const
inline

◆ operator>=()

bool mn::basic_timestamp::operator>= ( const self_type ts) const
inline

◆ swap()

void mn::basic_timestamp::swap ( self_type time)

◆ update()

void mn::basic_timestamp::update ( )

Member Data Documentation

◆ m_time

time_type mn::basic_timestamp::m_time
private

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