ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Methods | List of all members
Ticks Class Reference

#include <ticks.hpp>

Inheritance diagram for Ticks:
[legend]
Collaboration diagram for Ticks:
[legend]

Class Description


This class provides an interface into system dependent steady, monotonic timer values, which are independent from the system's clock settings, hence independent from changes of the clock by the user, by external clock synchronization using the internet, GPS, mobile network, etc.

Usually, this class is used to measure and store durations (e.g. with inherited method Age). As tick values are not just system dependent, but even usually change with a reboot of a system, they should not be stored and loaded in data files or otherwise shared between systems.

In contrast to sibling type DateTime, this class is also missing conversion methods with types that represent "human" calendar dates and a clock times. However, in some situations it still may be needed to convert the points in time measured with this class to human readable date and time representations. For this purpose, class TickConverter allows to convert objects of this type to objects of sibling type DateTime, which then can be further converted to system-dependent calendar dates and clock times.

The class has no specific interface, but the methods and operators inherited from base TimePointBase.

Definition at line 39 of file ticks.hpp.

Public Methods

bool operator!= (const Ticks &other) const
 
bool operator< (const Ticks &other) const
 
bool operator<= (const Ticks &other) const
 
bool operator== (const Ticks &other) const
 
bool operator> (const Ticks &other) const
 
bool operator>= (const Ticks &other) const
 
- Public Methods inherited from TimePointBase< std::chrono::steady_clock, Ticks >
ALIB_CPP14_CONSTEXPR TimePointBase (Initialization init=Initialization::Perform)
 
constexpr TimePointBase (TTimePoint internalValue)
 
Duration Age () const
 
TTimePoint Export () const
 
void Import (TTimePoint timePoint)
 
bool IsOlderThan (Duration timeSpan) const
 
bool IsSet ()
 
Ticks operator+ (const Duration &timeSpan) const
 
Ticks operator+= (const Duration &timeSpan)
 
Ticks operator- (const Duration &timeSpan) const
 
Duration operator- (const Ticks &other) const
 
Ticks operator-= (const Duration &timeSpan)
 
void SetAs (const Ticks &other)
 
void SetFromRaw (TRaw raw)
 
Duration Since (const Ticks &other) const
 
TRaw ToRaw () const
 
void Unset ()
 

Additional Inherited Members

- Public Types inherited from TimePointBase< std::chrono::steady_clock, Ticks >
using TRaw = typename TTimePoint::rep
 
using TTimePoint = typename std::chrono::steady_clock ::time_point
 
- Public Static Methods inherited from TimePointBase< std::chrono::steady_clock, Ticks >
static Ticks FromRaw (TRaw raw)
 
static Ticks Now ()
 
- Protected Fields inherited from TimePointBase< std::chrono::steady_clock, Ticks >
TTimePoint stamp
 

Member Function Documentation

◆ operator!=()

bool operator!= ( const Ticks other) const
inline

Not equal to operator.

Parameters
otherThe time stamp to compare.
Returns
The result of the comparison.

Definition at line 65 of file ticks.hpp.

◆ operator<()

bool operator< ( const Ticks other) const
inline

Less than operator.

Parameters
otherThe time stamp to compare.
Returns
A reference to this object.

Definition at line 75 of file ticks.hpp.

◆ operator<=()

bool operator<= ( const Ticks other) const
inline

Less than or equal to operator.

Parameters
otherThe time stamp to compare.
Returns
The result of the comparison.

Definition at line 85 of file ticks.hpp.

◆ operator==()

bool operator== ( const Ticks other) const
inline

Equal to operator.

Parameters
otherThe time stamp to compare.
Returns
The result of the comparison.

Definition at line 54 of file ticks.hpp.

◆ operator>()

bool operator> ( const Ticks other) const
inline

Greater than operator.

Parameters
otherThe time stamp to compare.
Returns
The result of the comparison.

Definition at line 95 of file ticks.hpp.

◆ operator>=()

bool operator>= ( const Ticks other) const
inline

Greater than or equal to operator.

Parameters
otherThe time stamp to compare.
Returns
The result of the comparison.

Definition at line 105 of file ticks.hpp.


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