FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
TimePointCache Class Reference

Cache locale-specific time data around a particular point in time. More...

#include <time_point.hpp>

Public Member Functions

 TimePointCache ()
 Null constructor that does no work. More...
 
 TimePointCache (const time_t asOfPOSIXepoch)
 Create a TimePointCache based around a specific point in time. More...
 
 TimePointCache (const struct timespec &asIfOnDay)
 Create a TimePointCache around a time expressed as a timespec, which is represented using the POSIX epoch. The resulting expanded times will be relative to the local time. More...
 
 TimePointCache (const struct tm &asIfOnDay)
 Create a TimePointCache based around a local expanded time. More...
 
void initializeForDay (const struct tm &asIfOnDay)
 Initialize a TimePointCache around an already expanded time, which is intended to reflect a local time. More...
 
void initializeForDay (const struct timespec &asIfOnDay)
 Initialize a TimePointCache around a time specified using a timespec, which is based on the POSIX epoch. The resulting expanded times will be relative to the local time. More...
 
bool isForDay (const time_t t) const OME_ALWAYS_INLINE
 
void initializeForDay (const time_t asOfPOSIXepoch)
 Initialize a TimePointCache based around a specific point in time. More...
 
int32_t offsetFromUTC () const OME_ALWAYS_INLINE
 
bool isForDay (const struct tm &dayOfInterest) const
 

Public Attributes

struct tm localMidnight
 
struct tm localEndOfDay
 
struct tm local3am
 
struct tm lastTime
 
struct tm utc3am
 
time_t localMidnightEpoch
 
time_t localEndOfDayEpoch
 
time_t local3amEpoch
 
time_t lastTimeEpoch
 
int32_t utcDifferenceSeconds
 

Detailed Description

Cache locale-specific time data around a particular point in time.

TimePointCache objects maintain information about the local midnight, end of day, and 3am of a specific day to enable efficient manipulation of times that occur within that day. While their use is optional, appropriately constructed TimePointCache objects enable expensive library calls to be avoided when dealing with times that occur within a particular day. Since more than one TimePointCache can be created, multiple threads can be handling information from different days without creating interference.

See also
TimePointCacheTable

Constructor & Destructor Documentation

◆ TimePointCache() [1/4]

TimePointCache::TimePointCache ( )
inline

Null constructor that does no work.

References localEndOfDayEpoch.

◆ TimePointCache() [2/4]

TimePointCache::TimePointCache ( const time_t  asOfPOSIXepoch)
inlineexplicit

Create a TimePointCache based around a specific point in time.

Parameters
asOfPOSIXepochindicates the desired point in time based on the POSIX epoch. If the value of 0 is specified, the current time is retrieved using clock_gettime_via_tick().

References initializeForDay(), and localEndOfDayEpoch.

◆ TimePointCache() [3/4]

TimePointCache::TimePointCache ( const struct timespec &  asIfOnDay)
inlineexplicit

Create a TimePointCache around a time expressed as a timespec, which is represented using the POSIX epoch. The resulting expanded times will be relative to the local time.

Note
The asIfOnDay structure is passed by reference since the address of the tv_sec member is taken.

References initializeForDay().

◆ TimePointCache() [4/4]

TimePointCache::TimePointCache ( const struct tm &  asIfOnDay)
inlineexplicit

Create a TimePointCache based around a local expanded time.

References initializeForDay().

Member Function Documentation

◆ initializeForDay() [1/3]

void TimePointCache::initializeForDay ( const struct timespec &  asIfOnDay)
inline

Initialize a TimePointCache around a time specified using a timespec, which is based on the POSIX epoch. The resulting expanded times will be relative to the local time.

Note
The asIfOnDay structure is passed by reference since the address of the tv_sec member is taken.

References CALL_TZSET, and initializeForDay().

◆ initializeForDay() [2/3]

void TimePointCache::initializeForDay ( const struct tm &  asIfOnDay)
inline

Initialize a TimePointCache around an already expanded time, which is intended to reflect a local time.

References lastTime, lastTimeEpoch, local3am, local3amEpoch, localEndOfDay, localEndOfDayEpoch, localMidnight, localMidnightEpoch, utc3am, and utcDifferenceSeconds.

Referenced by initializeForDay(), and TimePointCache().

◆ initializeForDay() [3/3]

void TimePointCache::initializeForDay ( const time_t  asOfPOSIXepoch)
inline

Initialize a TimePointCache based around a specific point in time.

Parameters
asOfPOSIXepochindicates the desired point in time based on the POSIX epoch. If the value of 0 is specified, the current time is retrieved using clock_gettime_via_tick().

The heavy overhead of initialization will not be performed again if the TimePointCache object is already representing the indicated day.

References clock_gettime_via_tick(), initializeForDay(), and isForDay().

◆ isForDay() [1/2]

bool TimePointCache::isForDay ( const struct tm &  dayOfInterest) const
inline

References local3am.

◆ isForDay() [2/2]

bool TimePointCache::isForDay ( const time_t  t) const
inline

◆ offsetFromUTC()

int32_t TimePointCache::offsetFromUTC ( ) const
inline

Member Data Documentation

◆ lastTime

struct tm TimePointCache::lastTime

Referenced by initializeForDay().

◆ lastTimeEpoch

time_t TimePointCache::lastTimeEpoch

Referenced by initializeForDay().

◆ local3am

struct tm TimePointCache::local3am

Referenced by initializeForDay(), and isForDay().

◆ local3amEpoch

time_t TimePointCache::local3amEpoch

Referenced by initializeForDay().

◆ localEndOfDay

struct tm TimePointCache::localEndOfDay

Referenced by initializeForDay().

◆ localEndOfDayEpoch

time_t TimePointCache::localEndOfDayEpoch

◆ localMidnight

struct tm TimePointCache::localMidnight

Referenced by initializeForDay().

◆ localMidnightEpoch

time_t TimePointCache::localMidnightEpoch

Referenced by initializeForDay(), and isForDay().

◆ utc3am

struct tm TimePointCache::utc3am

Referenced by initializeForDay().

◆ utcDifferenceSeconds

int32_t TimePointCache::utcDifferenceSeconds

Referenced by initializeForDay(), and offsetFromUTC().


The documentation for this class was generated from the following file:
Generated: Tue Jul 28 2020 16:03:27
Support Information