This is Unofficial EPICS BASE Doxygen Site
epicsTimeLoadTimeInit Class Reference

Public Member Functions

 epicsTimeLoadTimeInit ()
 

Public Attributes

double epicsEpochOffset
 
double time_tSecPerTick
 
unsigned long epicsEpochOffsetAsAnUnsignedLong
 
bool useDiffTimeOptimization
 

Detailed Description

Definition at line 74 of file epicsTime.cpp.

Constructor & Destructor Documentation

epicsTimeLoadTimeInit::epicsTimeLoadTimeInit ( )

Definition at line 86 of file epicsTime.cpp.

87 {
88  // All we know about time_t is that it is an arithmetic type.
89  time_t t_zero = static_cast<time_t> (0);
90  time_t t_one = static_cast<time_t> (1);
91  this->time_tSecPerTick = difftime (t_one, t_zero);
92 
93  /* The EPICS epoch (1/1/1990 00:00:00UTC) was 631152000 seconds after
94  * the ANSI epoch (1/1/1970 00:00:00UTC)
95  * Convert this offset into time_t units, however this must not be
96  * calculated using local time (i.e. using mktime() or similar), since
97  * in the UK the ANSI Epoch had daylight saving time in effect, and
98  * the value calculated would be 3600 seconds wrong.*/
99  this->epicsEpochOffset =
101 
102  if (this->time_tSecPerTick == 1.0 &&
103  this->epicsEpochOffset <= ULONG_MAX &&
104  this->epicsEpochOffset >= 0) {
105  // We can use simpler code on Posix-compliant systems
106  this->useDiffTimeOptimization = true;
108  static_cast<unsigned long>(this->epicsEpochOffset);
109  } else {
110  // Forced to use the slower but correct code
111  this->useDiffTimeOptimization = false;
113  }
114 }
unsigned long epicsEpochOffsetAsAnUnsignedLong
Definition: epicsTime.cpp:79
#define POSIX_TIME_AT_EPICS_EPOCH
The EPICS Epoch is 00:00:00 Jan 1, 1990 UTC.
Definition: epicsTime.h:26

Member Data Documentation

double epicsTimeLoadTimeInit::epicsEpochOffset

Definition at line 77 of file epicsTime.cpp.

unsigned long epicsTimeLoadTimeInit::epicsEpochOffsetAsAnUnsignedLong

Definition at line 79 of file epicsTime.cpp.

double epicsTimeLoadTimeInit::time_tSecPerTick

Definition at line 78 of file epicsTime.cpp.

bool epicsTimeLoadTimeInit::useDiffTimeOptimization

Definition at line 80 of file epicsTime.cpp.


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