This is Unofficial EPICS BASE Doxygen Site
epicsTime.h File Reference

EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times. More...

#include <time.h>
#include "libComAPI.h"
#include "epicsTypes.h"
#include "osdTime.h"
#include "errMdef.h"
+ Include dependency graph for epicsTime.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  epicsTimeStamp
 EPICS time stamp, for use from C code. More...
 

Macros

#define POSIX_TIME_AT_EPICS_EPOCH   631152000u
 The EPICS Epoch is 00:00:00 Jan 1, 1990 UTC. More...
 
#define TS_STAMP   epicsTimeStamp
 Old time-stamp data type, deprecated. More...
 
Return status values

epicsTime routines return S_time_ error status values:

#define epicsTimeOK   0
 Success. More...
 
#define S_time_noProvider   (M_time| 1) /*No time provider*/
 No time provider. More...
 
#define S_time_badEvent   (M_time| 2) /*Bad event number*/
 Bad event number. More...
 
#define S_time_badArgs   (M_time| 3) /*Invalid arguments*/
 Invalid arguments. More...
 
#define S_time_noMemory   (M_time| 4) /*Out of memory*/
 Out of memory. More...
 
#define S_time_unsynchronized   (M_time| 5) /*Provider not synchronized*/
 Provider not synchronized. More...
 
#define S_time_timezone   (M_time| 6) /*Invalid timezone*/
 Invalid timezone. More...
 
#define S_time_conversion   (M_time| 7) /*Time conversion error*/
 Time conversion error. More...
 
epicsTimeEvent numbers

Some special values for eventNumber:

#define epicsTimeEventCurrentTime   0
 
#define epicsTimeEventBestTime   -1
 
#define epicsTimeEventDeviceTime   -2
 

Typedefs

typedef struct epicsTimeStamp epicsTimeStamp
 EPICS time stamp, for use from C code. More...
 

Functions

LIBCOM_API size_t epicsStdCall epicsTimeToStrftime (char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS)
 Convert epicsTimeStamp to string. See epicsTime::strftime() More...
 
LIBCOM_API void epicsStdCall epicsTimeShow (const epicsTimeStamp *, unsigned interestLevel)
 Dump current state to stdout. More...
 
generalTime functions

These are implemented in the "generalTime" framework:

LIBCOM_API int epicsStdCall epicsTimeGetCurrent (epicsTimeStamp *pDest)
 Get current time into *pDest. More...
 
LIBCOM_API int epicsStdCall epicsTimeGetEvent (epicsTimeStamp *pDest, int eventNumber)
 Get time of event eventNumber into *pDest. More...
 
LIBCOM_API int epicsTimeGetMonotonic (epicsTimeStamp *pDest)
 Get monotonic time into *pDest. More...
 
ISR-callable

These routines may be called from an Interrupt Service Routine, and will return a value from the last current time or event time provider that sucessfully returned a result from the equivalent non-ISR routine.

LIBCOM_API int epicsTimeGetCurrentInt (epicsTimeStamp *pDest)
 Get current time into *pDest (ISR-safe) More...
 
LIBCOM_API int epicsTimeGetEventInt (epicsTimeStamp *pDest, int eventNumber)
 Get time of event eventNumber into *pDest (ISR-safe) More...
 
ANSI C time_t conversions

Convert to and from ANSI C time_t

LIBCOM_API int epicsStdCall epicsTimeToTime_t (time_t *pDest, const epicsTimeStamp *pSrc)
 Convert epicsTimeStamp to ANSI C time_t. More...
 
LIBCOM_API int epicsStdCall epicsTimeFromTime_t (epicsTimeStamp *pDest, time_t src)
 Convert ANSI C time_t to epicsTimeStamp. More...
 
ANSI C struct tm conversions

Convert to and from ANSI C's struct tm with nanoseconds

LIBCOM_API int epicsStdCall epicsTimeToTM (struct tm *pDest, unsigned long *pNSecDest, const epicsTimeStamp *pSrc)
 Convert epicsTimeStamp to struct tm in local time zone. More...
 
LIBCOM_API int epicsStdCall epicsTimeToGMTM (struct tm *pDest, unsigned long *pNSecDest, const epicsTimeStamp *pSrc)
 Convert epicsTimeStamp to struct tm in UTC/GMT. More...
 
LIBCOM_API int epicsStdCall epicsTimeFromTM (epicsTimeStamp *pDest, const struct tm *pSrc, unsigned long nSecSrc)
 Set epicsTimeStamp from struct tm in local time zone. More...
 
LIBCOM_API int epicsStdCall epicsTimeFromGMTM (epicsTimeStamp *pDest, const struct tm *pSrc, unsigned long nSecSrc)
 Set epicsTimeStamp from struct tm in UTC/GMT. More...
 
POSIX RT struct timespec conversions

Convert to and from the POSIX RealTime struct timespec format.

LIBCOM_API int epicsStdCall epicsTimeToTimespec (struct timespec *pDest, const epicsTimeStamp *pSrc)
 Convert epicsTimeStamp to struct timespec More...
 
LIBCOM_API int epicsStdCall epicsTimeFromTimespec (epicsTimeStamp *pDest, const struct timespec *pSrc)
 Set epicsTimeStamp from struct timespec More...
 
BSD's struct timeval conversions

Convert to and from the BSD struct timeval format.

LIBCOM_API int epicsStdCall epicsTimeToTimeval (struct timeval *pDest, const epicsTimeStamp *pSrc)
 Convert epicsTimeStamp to struct timeval More...
 
LIBCOM_API int epicsStdCall epicsTimeFromTimeval (epicsTimeStamp *pDest, const struct timeval *pSrc)
 Set epicsTimeStamp from struct timeval More...
 
Arithmetic operations

Arithmetic operations on epicsTimeStamp objects and time differences which are always expressed as a double in seconds.

LIBCOM_API double epicsStdCall epicsTimeDiffInSeconds (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
 Time difference between left and right in seconds. More...
 
LIBCOM_API void epicsStdCall epicsTimeAddSeconds (epicsTimeStamp *pDest, double secondsToAdd)
 Add some number of seconds to dest. More...
 
Comparison operators

Comparisons between epicsTimeStamp objects, returning 0=false, 1=true.

LIBCOM_API int epicsStdCall epicsTimeEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
 left equals right More...
 
LIBCOM_API int epicsStdCall epicsTimeNotEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
 left not equal to right More...
 
LIBCOM_API int epicsStdCall epicsTimeLessThan (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
 left was before right More...
 
LIBCOM_API int epicsStdCall epicsTimeLessThanEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
 right was no later than left More...
 
LIBCOM_API int epicsStdCall epicsTimeGreaterThan (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
 left was after right More...
 
LIBCOM_API int epicsStdCall epicsTimeGreaterThanEqual (const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
 right was not before left More...
 
Reentrant time_t to struct tm conversions

OS-specific reentrant versions of the ANSI C interface because the vxWorks gmtime_r interface does not match POSIX standards

LIBCOM_API int epicsStdCall epicsTime_localtime (const time_t *clock, struct tm *result)
 Break down a time_t into a struct tm in the local timezone. More...
 
LIBCOM_API int epicsStdCall epicsTime_gmtime (const time_t *clock, struct tm *result)
 Break down a time_t into a struct tm in the UTC timezone. More...
 
Monotonic time routines
LIBCOM_API epicsUInt64 epicsMonotonicResolution (void)
 Monotonic time resolution, may not be accurate. Returns the minimum non-zero time difference between two calls to epicsMonotonicGet() in units of nanoseconds. More...
 
LIBCOM_API epicsUInt64 epicsMonotonicGet (void)
 Fetch monotonic counter, returns the number of nanoseconds since some unspecified time. More...
 

Detailed Description

EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times.

Author
Jeffrey O. Hill

Definition in file epicsTime.h.

Macro Definition Documentation

#define epicsTimeEventBestTime   -1

Definition at line 361 of file epicsTime.h.

#define epicsTimeEventCurrentTime   0

Definition at line 360 of file epicsTime.h.

#define epicsTimeEventDeviceTime   -2

Definition at line 362 of file epicsTime.h.

#define epicsTimeOK   0

Success.

Definition at line 339 of file epicsTime.h.

#define POSIX_TIME_AT_EPICS_EPOCH   631152000u

The EPICS Epoch is 00:00:00 Jan 1, 1990 UTC.

Definition at line 26 of file epicsTime.h.

#define S_time_badArgs   (M_time| 3) /*Invalid arguments*/

Invalid arguments.

Definition at line 345 of file epicsTime.h.

#define S_time_badEvent   (M_time| 2) /*Bad event number*/

Bad event number.

Definition at line 343 of file epicsTime.h.

#define S_time_conversion   (M_time| 7) /*Time conversion error*/

Time conversion error.

Definition at line 353 of file epicsTime.h.

#define S_time_noMemory   (M_time| 4) /*Out of memory*/

Out of memory.

Definition at line 347 of file epicsTime.h.

#define S_time_noProvider   (M_time| 1) /*No time provider*/

No time provider.

Definition at line 341 of file epicsTime.h.

#define S_time_timezone   (M_time| 6) /*Invalid timezone*/

Invalid timezone.

Definition at line 351 of file epicsTime.h.

#define S_time_unsynchronized   (M_time| 5) /*Provider not synchronized*/

Provider not synchronized.

Definition at line 349 of file epicsTime.h.

#define TS_STAMP   epicsTimeStamp

Old time-stamp data type, deprecated.

Deprecated:
TS_STAMP was provided for compatibility with Base-3.13 code. It will be removed in some future release of EPICS 7.

Definition at line 42 of file epicsTime.h.

Typedef Documentation

EPICS time stamp, for use from C code.

Because it uses an unsigned 32-bit integer to hold the seconds count, an epicsTimeStamp can safely represent time stamps until the year 2106.

Function Documentation

LIBCOM_API epicsUInt64 epicsMonotonicGet ( void  )

Fetch monotonic counter, returns the number of nanoseconds since some unspecified time.

Definition at line 29 of file osdMonotonic.c.

30 {
31  uint64_t val = mach_absolute_time();
32  return val * tbinfo.numer / tbinfo.denom;
33 }
LIBCOM_API epicsUInt64 epicsMonotonicResolution ( void  )

Monotonic time resolution, may not be accurate. Returns the minimum non-zero time difference between two calls to epicsMonotonicGet() in units of nanoseconds.

Definition at line 24 of file osdMonotonic.c.

25 {
26  return 1e-9 * tbinfo.numer / tbinfo.denom;
27 }
LIBCOM_API int epicsStdCall epicsTime_gmtime ( const time_t *  clock,
struct tm *  result 
)

Break down a time_t into a struct tm in the UTC timezone.

Definition at line 55 of file osdTime.cpp.

56 {
57  return gmtime_r(pAnsiTime, pTM) ?
58  epicsTimeOK : errno;
59 }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
LIBCOM_API int epicsStdCall epicsTime_localtime ( const time_t *  clock,
struct tm *  result 
)

Break down a time_t into a struct tm in the local timezone.

Definition at line 61 of file osdTime.cpp.

62 {
63  return localtime_r(clock, result) ?
64  epicsTimeOK : errno;
65 }
pvac::PutEvent result
Definition: clientSync.cpp:117
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
LIBCOM_API void epicsStdCall epicsTimeAddSeconds ( epicsTimeStamp pDest,
double  secondsToAdd 
)

Add some number of seconds to dest.

Definition at line 1057 of file epicsTime.cpp.

1058  {
1059  try {
1060  *pDest = epicsTime (*pDest) + seconds;
1061  }
1062  catch ( ... ) {
1063  *pDest = epicsTime ();
1064  }
1065  }
LIBCOM_API double epicsStdCall epicsTimeDiffInSeconds ( const epicsTimeStamp pLeft,
const epicsTimeStamp pRight 
)

Time difference between left and right in seconds.

Definition at line 1048 of file epicsTime.cpp.

1049  {
1050  try {
1051  return epicsTime (*pLeft) - epicsTime (*pRight);
1052  }
1053  catch (...) {
1054  return - DBL_MAX;
1055  }
1056  }
LIBCOM_API int epicsStdCall epicsTimeEqual ( const epicsTimeStamp pLeft,
const epicsTimeStamp pRight 
)

left equals right

Definition at line 1066 of file epicsTime.cpp.

1067  {
1068  try {
1069  return epicsTime (*pLeft) == epicsTime (*pRight);
1070  }
1071  catch ( ... ) {
1072  return 0;
1073  }
1074  }
LIBCOM_API int epicsStdCall epicsTimeFromGMTM ( epicsTimeStamp pDest,
const struct tm *  pSrc,
unsigned long  nSecSrc 
)

Set epicsTimeStamp from struct tm in UTC/GMT.

Definition at line 995 of file epicsTime.cpp.

996  {
997  try {
998  gm_tm_nano_sec tmns;
999  tmns.ansi_tm = *pSrc;
1000  tmns.nSec = nSecSrc;
1001  *pDest = epicsTime (tmns);
1002  }
1003  catch (...) {
1004  return S_time_conversion;
1005  }
1006  return epicsTimeOK;
1007  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeFromTime_t ( epicsTimeStamp pDest,
time_t  src 
)

Convert ANSI C time_t to epicsTimeStamp.

Definition at line 944 of file epicsTime.cpp.

945  {
946  try {
947  time_t_wrapper dst;
948  dst.ts = src;
949  *pDest = epicsTime ( dst );
950  }
951  catch (...) {
952  return S_time_conversion;
953  }
954  return epicsTimeOK;
955  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeFromTimespec ( epicsTimeStamp pDest,
const struct timespec pSrc 
)

Set epicsTimeStamp from struct timespec

Definition at line 1018 of file epicsTime.cpp.

1019  {
1020  try {
1021  *pDest = epicsTime (*pSrc);
1022  }
1023  catch (...) {
1024  return S_time_conversion;
1025  }
1026  return epicsTimeOK;
1027  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeFromTimeval ( epicsTimeStamp pDest,
const struct timeval pSrc 
)

Set epicsTimeStamp from struct timeval

Definition at line 1038 of file epicsTime.cpp.

1039  {
1040  try {
1041  *pDest = epicsTime (*pSrc);
1042  }
1043  catch (...) {
1044  return S_time_conversion;
1045  }
1046  return epicsTimeOK;
1047  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeFromTM ( epicsTimeStamp pDest,
const struct tm *  pSrc,
unsigned long  nSecSrc 
)

Set epicsTimeStamp from struct tm in local time zone.

Definition at line 982 of file epicsTime.cpp.

983  {
984  try {
985  local_tm_nano_sec tmns;
986  tmns.ansi_tm = *pSrc;
987  tmns.nSec = nSecSrc;
988  *pDest = epicsTime (tmns);
989  }
990  catch (...) {
991  return S_time_conversion;
992  }
993  return epicsTimeOK;
994  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeGetCurrent ( epicsTimeStamp pDest)

Get current time into *pDest.

Definition at line 152 of file epicsGeneralTime.c.

153 {
154  gtProvider *ptp;
156  epicsTimeStamp ts;
157 
158  if(useOsdGetCurrent)
159  return osdTimeGetCurrent(pDest);
160 
162 
163  IFDEBUG(20)
165 
167  for (ptp = (gtProvider *)ellFirst(&gtPvt.timeProviders);
168  ptp; ptp = (gtProvider *)ellNext(&ptp->node)) {
169 
170  status = ptp->get.Time(&ts);
171  if (status == epicsTimeOK) {
172  /* check time is monotonic */
173  if (epicsTimeGreaterThanEqual(&ts, &gtPvt.lastProvidedTime)) {
174  *pDest = ts;
175  gtPvt.lastProvidedTime = ts;
176  gtPvt.lastTimeProvider = ptp;
177  } else {
178  int key;
179 
180  *pDest = gtPvt.lastProvidedTime;
181  key = epicsInterruptLock();
182  gtPvt.ErrorCounts++;
184 
185  IFDEBUG(10) {
186  char last[40], buff[40];
187 
188  epicsTimeToStrftime(last, sizeof(last), tsfmt,
189  &gtPvt.lastProvidedTime);
190  epicsTimeToStrftime(buff, sizeof(buff), tsfmt, &ts);
191  printf("eTGC provider '%s' returned older time\n"
192  " %s, using %s instead\n", ptp->name, buff, last);
193  }
194  }
195  break;
196  }
197  }
198  if (status)
199  gtPvt.lastTimeProvider = NULL;
200  epicsMutexUnlock(gtPvt.timeListLock);
201 
202  IFDEBUG(20) {
203  if (ptp && status == epicsTimeOK) {
204  char buff[40];
205 
206  epicsTimeToStrftime(buff, sizeof(buff), tsfmt, &ts);
207  printf("eTGC returning %s from provider '%s'\n",
208  buff, ptp->name);
209  }
210  else
211  printf("eTGC returning error\n");
212  }
213 
214  return status;
215 }
LIBCOM_API void epicsInterruptUnlock(int key)
Definition: osdInterrupt.c:41
epicsMutexId timeListLock
pvd::Status status
union gtProvider::@15 get
ELLLIST timeProviders
#define printf
Definition: epicsStdio.h:41
#define IFDEBUG(n)
#define NULL
Definition: catime.c:38
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
Definition: epicsMutex.cpp:140
LIBCOM_API int epicsInterruptLock(void)
Definition: osdInterrupt.c:34
int osdTimeGetCurrent(epicsTimeStamp *pDest)
Definition: osdTime.cpp:119
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
LIBCOM_API size_t epicsStdCall epicsTimeToStrftime(char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS)
Convert epicsTimeStamp to string. See epicsTime::strftime()
Definition: epicsTime.cpp:1120
LIBCOM_API int epicsStdCall epicsTimeGreaterThanEqual(const epicsTimeStamp *pLeft, const epicsTimeStamp *pRight)
right was not before left
Definition: epicsTime.cpp:1111
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
TIMECURRENTFUN Time
void generalTime_Init(void)
Initialise the framework.
#define S_time_noProvider
No time provider.
Definition: epicsTime.h:341
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
Definition: epicsMutex.h:214
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
LIBCOM_API int epicsTimeGetCurrentInt ( epicsTimeStamp pDest)

Get current time into *pDest (ISR-safe)

Definition at line 225 of file epicsGeneralTime.c.

226 {
227  gtProvider *ptp = gtPvt.lastTimeProvider;
228 
229  if (ptp == NULL ||
230  ptp->getInt.Time == NULL) {
231  IFDEBUG(20)
232  epicsInterruptContextMessage("eTGCInt: No support\n");
233  return S_time_noProvider;
234  }
235 
236  return ptp->getInt.Time(pDest);
237 }
#define IFDEBUG(n)
union gtProvider::@16 getInt
#define NULL
Definition: catime.c:38
LIBCOM_API void epicsInterruptContextMessage(const char *message)
Definition: osdInterrupt.c:53
TIMECURRENTFUN Time
#define S_time_noProvider
No time provider.
Definition: epicsTime.h:341
LIBCOM_API int epicsStdCall epicsTimeGetEvent ( epicsTimeStamp pDest,
int  eventNumber 
)

Get time of event eventNumber into *pDest.

Definition at line 341 of file epicsGeneralTime.c.

342 {
343  if (eventNumber == epicsTimeEventCurrentTime) {
344  return epicsTimeGetCurrent(pDest);
345  } else {
346  return generalTimeGetEventPriority(pDest, eventNumber, NULL);
347  }
348 }
#define NULL
Definition: catime.c:38
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
#define epicsTimeEventCurrentTime
Definition: epicsTime.h:360
LIBCOM_API int epicsTimeGetEventInt ( epicsTimeStamp pDest,
int  eventNumber 
)

Get time of event eventNumber into *pDest (ISR-safe)

Definition at line 350 of file epicsGeneralTime.c.

351 {
352  if (eventNumber == epicsTimeEventCurrentTime) {
353  return epicsTimeGetCurrentInt(pDest);
354  } else {
355  gtProvider *ptp = gtPvt.lastEventProvider;
356 
357  if (ptp == NULL ||
358  ptp->getInt.Event == NULL) {
359  IFDEBUG(20)
360  epicsInterruptContextMessage("eTGEvInt: No support\n");
361  return S_time_noProvider;
362  }
363 
364  return ptp->getInt.Event(pDest, eventNumber);
365  }
366 }
#define IFDEBUG(n)
union gtProvider::@16 getInt
#define NULL
Definition: catime.c:38
TIMEEVENTFUN Event
LIBCOM_API void epicsInterruptContextMessage(const char *message)
Definition: osdInterrupt.c:53
#define S_time_noProvider
No time provider.
Definition: epicsTime.h:341
int epicsTimeGetCurrentInt(epicsTimeStamp *pDest)
Get current time into *pDest (ISR-safe)
#define epicsTimeEventCurrentTime
Definition: epicsTime.h:360
LIBCOM_API int epicsTimeGetMonotonic ( epicsTimeStamp pDest)

Get monotonic time into *pDest.

Definition at line 217 of file epicsGeneralTime.c.

218 {
220  pDest->nsec = now%1000000000ul;
221  pDest->secPastEpoch = now/1000000000ul;
222  return 0;
223 }
LIBCOM_API epicsUInt64 epicsMonotonicGet(void)
Fetch monotonic counter, returns the number of nanoseconds since some unspecified time...
Definition: osdMonotonic.c:29
epicsUInt32 secPastEpoch
seconds since 0000 Jan 1, 1990
Definition: epicsTime.h:34
unsigned long long epicsUInt64
Definition: epicsTypes.h:45
epicsUInt32 nsec
nanoseconds within second
Definition: epicsTime.h:35
LIBCOM_API int epicsStdCall epicsTimeGreaterThan ( const epicsTimeStamp pLeft,
const epicsTimeStamp pRight 
)

left was after right

Definition at line 1102 of file epicsTime.cpp.

1103  {
1104  try {
1105  return epicsTime (*pLeft) > epicsTime (*pRight);
1106  }
1107  catch ( ... ) {
1108  return 0;
1109  }
1110  }
LIBCOM_API int epicsStdCall epicsTimeGreaterThanEqual ( const epicsTimeStamp pLeft,
const epicsTimeStamp pRight 
)

right was not before left

Definition at line 1111 of file epicsTime.cpp.

1112  {
1113  try {
1114  return epicsTime (*pLeft) >= epicsTime (*pRight);
1115  }
1116  catch ( ... ) {
1117  return 0;
1118  }
1119  }
LIBCOM_API int epicsStdCall epicsTimeLessThan ( const epicsTimeStamp pLeft,
const epicsTimeStamp pRight 
)

left was before right

Definition at line 1084 of file epicsTime.cpp.

1085  {
1086  try {
1087  return epicsTime (*pLeft) < epicsTime (*pRight);
1088  }
1089  catch ( ... ) {
1090  return 0;
1091  }
1092  }
LIBCOM_API int epicsStdCall epicsTimeLessThanEqual ( const epicsTimeStamp pLeft,
const epicsTimeStamp pRight 
)

right was no later than left

Definition at line 1093 of file epicsTime.cpp.

1094  {
1095  try {
1096  return epicsTime (*pLeft) <= epicsTime (*pRight);
1097  }
1098  catch ( ... ) {
1099  return 0;
1100  }
1101  }
LIBCOM_API int epicsStdCall epicsTimeNotEqual ( const epicsTimeStamp pLeft,
const epicsTimeStamp pRight 
)

left not equal to right

Definition at line 1075 of file epicsTime.cpp.

1076  {
1077  try {
1078  return epicsTime (*pLeft) != epicsTime (*pRight);
1079  }
1080  catch ( ... ) {
1081  return 1;
1082  }
1083  }
LIBCOM_API void epicsStdCall epicsTimeShow ( const epicsTimeStamp ,
unsigned  interestLevel 
)

Dump current state to stdout.

Definition at line 1129 of file epicsTime.cpp.

1130  {
1131  try {
1132  epicsTime(*pTS).show (interestLevel);
1133  }
1134  catch ( ... ) {
1135  printf ( "Invalid epicsTimeStamp\n" );
1136  }
1137  }
#define printf
Definition: epicsStdio.h:41
LIBCOM_API int epicsStdCall epicsTimeToGMTM ( struct tm *  pDest,
unsigned long *  pNSecDest,
const epicsTimeStamp pSrc 
)

Convert epicsTimeStamp to struct tm in UTC/GMT.

Definition at line 969 of file epicsTime.cpp.

970  {
971  try {
972  gm_tm_nano_sec gmtmns = epicsTime (*pSrc);
973  *pDest = gmtmns.ansi_tm;
974  if (pNSecDest)
975  *pNSecDest = gmtmns.nSec;
976  }
977  catch (...) {
978  return S_time_conversion;
979  }
980  return epicsTimeOK;
981  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API size_t epicsStdCall epicsTimeToStrftime ( char *  pBuff,
size_t  bufLength,
const char *  pFormat,
const epicsTimeStamp pTS 
)

Convert epicsTimeStamp to string. See epicsTime::strftime()

Definition at line 1120 of file epicsTime.cpp.

1121  {
1122  try {
1123  return epicsTime(*pTS).strftime (pBuff, bufLength, pFormat);
1124  }
1125  catch ( ... ) {
1126  return 0;
1127  }
1128  }
LIBCOM_API int epicsStdCall epicsTimeToTime_t ( time_t *  pDest,
const epicsTimeStamp pSrc 
)

Convert epicsTimeStamp to ANSI C time_t.

Definition at line 933 of file epicsTime.cpp.

934  {
935  try {
936  time_t_wrapper dst = epicsTime (*pSrc);
937  *pDest = dst.ts;
938  }
939  catch (...) {
940  return S_time_conversion;
941  }
942  return epicsTimeOK;
943  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeToTimespec ( struct timespec pDest,
const epicsTimeStamp pSrc 
)

Convert epicsTimeStamp to struct timespec

Definition at line 1008 of file epicsTime.cpp.

1009  {
1010  try {
1011  *pDest = epicsTime (*pSrc);
1012  }
1013  catch (...) {
1014  return S_time_conversion;
1015  }
1016  return epicsTimeOK;
1017  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeToTimeval ( struct timeval pDest,
const epicsTimeStamp pSrc 
)

Convert epicsTimeStamp to struct timeval

Definition at line 1028 of file epicsTime.cpp.

1029  {
1030  try {
1031  *pDest = epicsTime (*pSrc);
1032  }
1033  catch (...) {
1034  return S_time_conversion;
1035  }
1036  return epicsTimeOK;
1037  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353
LIBCOM_API int epicsStdCall epicsTimeToTM ( struct tm *  pDest,
unsigned long *  pNSecDest,
const epicsTimeStamp pSrc 
)

Convert epicsTimeStamp to struct tm in local time zone.

Definition at line 956 of file epicsTime.cpp.

957  {
958  try {
959  local_tm_nano_sec tmns = epicsTime (*pSrc);
960  *pDest = tmns.ansi_tm;
961  if (pNSecDest)
962  *pNSecDest = tmns.nSec;
963  }
964  catch (...) {
965  return S_time_conversion;
966  }
967  return epicsTimeOK;
968  }
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_conversion
Time conversion error.
Definition: epicsTime.h:353