FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
POSIXtimeInUnits< UNITS > Class Template Reference

Representation of UNITS-since-POSIX-epoch. This is an unambiguous time reference; there is no locale-specific attribute. More...

#include <time_point.hpp>

Public Member Functions

uint64_t convertToCustomEpochUnits (uint64_t desired_granularity=UNITS) const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Converts from a POSIXtimeInUnits to an arbitrary granularity. More...
 
 POSIXtimeInUnits (time_t seconds, int64_t fractional, int skewByMinutes=0) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Construct a POSIXtimeInUnits from seconds since the POSIX epoch. More...
 
 POSIXtimeInUnits (const TimeWithNanoseconds time_ns, int skewByMinutes=0) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Construct a POSIXtimeInUnits from a TimeWithNanoseconds structure. More...
 
template<unsigned int ALT_UNITS>
 operator POSIXtimeInUnits< ALT_UNITS > () const OME_ALWAYS_INLINE
 Cast operator to convert to alternate unit precision. More...
 
POSIXtimeInUnits< UNITS > & operator= (const TimeWithNanoseconds time_ns) OME_ALWAYS_INLINE
 Assignment operator from TimeWithNanoseconds structure. More...
 
uint64_t convertToNanosecondsSinceEpoch () const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Convert a POSIXtimeInUnits to nanoseconds since the POSIX epoch. More...
 
time_t getSeconds () const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 Convert a POSIXtimeInUnits to seconds since the POSIX epoch. More...
 
template<unsigned int ALT_UNITS>
bool operator== (const POSIXtimeInUnits< ALT_UNITS > arg) const
 Equality comparison against a POSIXtimeInUnits of arbitrary granularity. More...
 
template<unsigned int ALT_UNITS>
bool operator!= (const POSIXtimeInUnits< ALT_UNITS > arg) const
 Inequality comparison against a POSIXtimeInUnits of arbitrary granularity. More...
 
template<unsigned int ALT_UNITS>
bool operator<= (const POSIXtimeInUnits< ALT_UNITS > arg) const
 Less-than-or-equal comparison against a POSIXtimeInUnits of arbitrary granularity. More...
 
template<unsigned int ALT_UNITS>
bool operator>= (const POSIXtimeInUnits< ALT_UNITS > arg) const
 Greater-than-or-equal comparison against a POSIXtimeInUnits of arbitrary granularity. More...
 
template<unsigned int ALT_UNITS>
bool operator< (const POSIXtimeInUnits< ALT_UNITS > arg) const
 Less-than comparison against a POSIXtimeInUnits of arbitrary granularity. More...
 
template<unsigned int ALT_UNITS>
bool operator> (const POSIXtimeInUnits< ALT_UNITS > arg) const
 Greater-than comparison against a POSIXtimeInUnits of arbitrary granularity. More...
 

Static Public Member Functions

static POSIXtimeInUnits< UNITS > getCurrentTime () OME_ALWAYS_INLINE
 Get the current time as units-since-the-POSIX epoch. More...
 

Protected Member Functions

void assignFromTimeWithNanoseconds (const TimeWithNanoseconds time_ns, const int skewByMinutes=0) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
 

Protected Attributes

uint64_t time_in_units
 holds total UNITS since POSIX epoch More...
 

Detailed Description

template<unsigned int UNITS>
class POSIXtimeInUnits< UNITS >

Representation of UNITS-since-POSIX-epoch. This is an unambiguous time reference; there is no locale-specific attribute.

Note
: this template exists to be able to handle arbitrary granularity of an incoming time unit.

Constructor & Destructor Documentation

◆ POSIXtimeInUnits() [1/2]

template<unsigned int UNITS>
POSIXtimeInUnits< UNITS >::POSIXtimeInUnits ( time_t  seconds,
int64_t  fractional,
int  skewByMinutes = 0 
)
inline

Construct a POSIXtimeInUnits from seconds since the POSIX epoch.

Parameters
secondsspecifies the number of seconds since the POSIX epoch.
fractionalspecifies the number of UNITS per second.
skewByMinutesis an optional parameter to allow the time to be skewed by the specified number of minutes. This is typically used to shift timezones.
Note
If seconds is 0, fractional can specify the total number of UNITS since the POSIX epoch.

References POSIXtimeInUnits< UNITS >::time_in_units.

◆ POSIXtimeInUnits() [2/2]

template<unsigned int UNITS>
POSIXtimeInUnits< UNITS >::POSIXtimeInUnits ( const TimeWithNanoseconds  time_ns,
int  skewByMinutes = 0 
)
inlineexplicit

Construct a POSIXtimeInUnits from a TimeWithNanoseconds structure.

Parameters
time_nsspecifies the time as a TimeWithNanoseconds structure.
skewByMinutesis an optional parameter to allow the time to be skewed by the specified number of minutes. This is typically used to shift timezones.

References POSIXtimeInUnits< UNITS >::assignFromTimeWithNanoseconds().

Member Function Documentation

◆ assignFromTimeWithNanoseconds()

template<unsigned int UNITS>
void POSIXtimeInUnits< UNITS >::assignFromTimeWithNanoseconds ( const TimeWithNanoseconds  time_ns,
const int  skewByMinutes = 0 
)
inlineprotected

◆ convertToCustomEpochUnits()

template<unsigned int UNITS>
uint64_t POSIXtimeInUnits< UNITS >::convertToCustomEpochUnits ( uint64_t  desired_granularity = UNITS) const
inline

Converts from a POSIXtimeInUnits to an arbitrary granularity.

Parameters
desired_granularityspecifies the desired granularity.
Note
Common usage is for desired_granularity to be passed as a constant at compile-time, which eliminates much of the code.

References POSIXtimeInUnits< UNITS >::time_in_units.

Referenced by TimePointOfGranularity< UNITS >::TimePointOfGranularity().

◆ convertToNanosecondsSinceEpoch()

template<unsigned int UNITS>
uint64_t POSIXtimeInUnits< UNITS >::convertToNanosecondsSinceEpoch ( ) const
inline

Convert a POSIXtimeInUnits to nanoseconds since the POSIX epoch.

References POSIXtimeInUnits< UNITS >::time_in_units.

Referenced by addLogArg(), and LogMessageRecord::prepareBinaryRecord().

◆ getCurrentTime()

template<unsigned int UNITS>
static POSIXtimeInUnits<UNITS> POSIXtimeInUnits< UNITS >::getCurrentTime ( )
inlinestatic

Get the current time as units-since-the-POSIX epoch.

Note
This is a static routine. Uses getCurrentTime() from get_time.h.

◆ getSeconds()

template<unsigned int UNITS>
time_t POSIXtimeInUnits< UNITS >::getSeconds ( ) const
inline

Convert a POSIXtimeInUnits to seconds since the POSIX epoch.

References POSIXtimeInUnits< UNITS >::time_in_units.

Referenced by ReadBinaryLog::outputAssembledLine().

◆ operator!=()

template<unsigned int UNITS>
template<unsigned int ALT_UNITS>
bool POSIXtimeInUnits< UNITS >::operator!= ( const POSIXtimeInUnits< ALT_UNITS >  arg) const
inline

Inequality comparison against a POSIXtimeInUnits of arbitrary granularity.

Parameters
argspecifies the time to be compared

References POSIXtimeInUnits< UNITS >::time_in_units.

◆ operator<()

template<unsigned int UNITS>
template<unsigned int ALT_UNITS>
bool POSIXtimeInUnits< UNITS >::operator< ( const POSIXtimeInUnits< ALT_UNITS >  arg) const
inline

Less-than comparison against a POSIXtimeInUnits of arbitrary granularity.

Parameters
argspecifies the time to be compared

References POSIXtimeInUnits< UNITS >::time_in_units.

◆ operator<=()

template<unsigned int UNITS>
template<unsigned int ALT_UNITS>
bool POSIXtimeInUnits< UNITS >::operator<= ( const POSIXtimeInUnits< ALT_UNITS >  arg) const
inline

Less-than-or-equal comparison against a POSIXtimeInUnits of arbitrary granularity.

Parameters
argspecifies the time to be compared

References POSIXtimeInUnits< UNITS >::time_in_units.

◆ operator=()

template<unsigned int UNITS>
POSIXtimeInUnits<UNITS>& POSIXtimeInUnits< UNITS >::operator= ( const TimeWithNanoseconds  time_ns)
inline

Assignment operator from TimeWithNanoseconds structure.

Parameters
time_nsspecifies the time as a TimeWithNanoseconds structure.

References POSIXtimeInUnits< UNITS >::assignFromTimeWithNanoseconds().

◆ operator==()

template<unsigned int UNITS>
template<unsigned int ALT_UNITS>
bool POSIXtimeInUnits< UNITS >::operator== ( const POSIXtimeInUnits< ALT_UNITS >  arg) const
inline

Equality comparison against a POSIXtimeInUnits of arbitrary granularity.

Parameters
argspecifies the time to be compared

References POSIXtimeInUnits< UNITS >::time_in_units.

◆ operator>()

template<unsigned int UNITS>
template<unsigned int ALT_UNITS>
bool POSIXtimeInUnits< UNITS >::operator> ( const POSIXtimeInUnits< ALT_UNITS >  arg) const
inline

Greater-than comparison against a POSIXtimeInUnits of arbitrary granularity.

Parameters
argspecifies the time to be compared

References POSIXtimeInUnits< UNITS >::time_in_units.

◆ operator>=()

template<unsigned int UNITS>
template<unsigned int ALT_UNITS>
bool POSIXtimeInUnits< UNITS >::operator>= ( const POSIXtimeInUnits< ALT_UNITS >  arg) const
inline

Greater-than-or-equal comparison against a POSIXtimeInUnits of arbitrary granularity.

Parameters
argspecifies the time to be compared

References POSIXtimeInUnits< UNITS >::time_in_units.

Member Data Documentation

◆ time_in_units


The documentation for this class was generated from the following file:
Generated: Fri Jul 31 2020 18:19:16
Support Information