![]() |
This is Unofficial EPICS BASE Doxygen Site
|
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"
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 | |
#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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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... | |
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times.
Definition in file epicsTime.h.
#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.
Definition at line 42 of file epicsTime.h.
typedef struct epicsTimeStamp epicsTimeStamp |
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.
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.
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.
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.
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.
LIBCOM_API void epicsStdCall epicsTimeAddSeconds | ( | epicsTimeStamp * | pDest, |
double | secondsToAdd | ||
) |
Add some number of seconds to dest
.
Definition at line 1057 of file epicsTime.cpp.
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.
LIBCOM_API int epicsStdCall epicsTimeEqual | ( | const epicsTimeStamp * | pLeft, |
const epicsTimeStamp * | pRight | ||
) |
left
equals right
Definition at line 1066 of file epicsTime.cpp.
LIBCOM_API int epicsStdCall epicsTimeFromGMTM | ( | epicsTimeStamp * | pDest, |
const struct tm * | pSrc, | ||
unsigned long | nSecSrc | ||
) |
LIBCOM_API int epicsStdCall epicsTimeFromTime_t | ( | epicsTimeStamp * | pDest, |
time_t | src | ||
) |
LIBCOM_API int epicsStdCall epicsTimeFromTimespec | ( | epicsTimeStamp * | pDest, |
const struct timespec * | pSrc | ||
) |
LIBCOM_API int epicsStdCall epicsTimeFromTimeval | ( | epicsTimeStamp * | pDest, |
const struct timeval * | pSrc | ||
) |
LIBCOM_API int epicsStdCall epicsTimeFromTM | ( | epicsTimeStamp * | pDest, |
const struct tm * | pSrc, | ||
unsigned long | nSecSrc | ||
) |
LIBCOM_API int epicsStdCall epicsTimeGetCurrent | ( | epicsTimeStamp * | pDest | ) |
Get current time into *pDest
.
Definition at line 152 of file epicsGeneralTime.c.
LIBCOM_API int epicsTimeGetCurrentInt | ( | epicsTimeStamp * | pDest | ) |
Get current time into *pDest
(ISR-safe)
Definition at line 225 of file epicsGeneralTime.c.
LIBCOM_API int epicsStdCall epicsTimeGetEvent | ( | epicsTimeStamp * | pDest, |
int | eventNumber | ||
) |
Get time of event eventNumber
into *pDest
.
Definition at line 341 of file epicsGeneralTime.c.
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.
LIBCOM_API int epicsTimeGetMonotonic | ( | epicsTimeStamp * | pDest | ) |
Get monotonic time into *pDest
.
Definition at line 217 of file epicsGeneralTime.c.
LIBCOM_API int epicsStdCall epicsTimeGreaterThan | ( | const epicsTimeStamp * | pLeft, |
const epicsTimeStamp * | pRight | ||
) |
left
was after right
Definition at line 1102 of file epicsTime.cpp.
LIBCOM_API int epicsStdCall epicsTimeGreaterThanEqual | ( | const epicsTimeStamp * | pLeft, |
const epicsTimeStamp * | pRight | ||
) |
right
was not before left
Definition at line 1111 of file epicsTime.cpp.
LIBCOM_API int epicsStdCall epicsTimeLessThan | ( | const epicsTimeStamp * | pLeft, |
const epicsTimeStamp * | pRight | ||
) |
left
was before right
Definition at line 1084 of file epicsTime.cpp.
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.
LIBCOM_API int epicsStdCall epicsTimeNotEqual | ( | const epicsTimeStamp * | pLeft, |
const epicsTimeStamp * | pRight | ||
) |
left
not equal to right
Definition at line 1075 of file epicsTime.cpp.
LIBCOM_API void epicsStdCall epicsTimeShow | ( | const epicsTimeStamp * | , |
unsigned | interestLevel | ||
) |
LIBCOM_API int epicsStdCall epicsTimeToGMTM | ( | struct tm * | pDest, |
unsigned long * | pNSecDest, | ||
const epicsTimeStamp * | pSrc | ||
) |
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.
LIBCOM_API int epicsStdCall epicsTimeToTime_t | ( | time_t * | pDest, |
const epicsTimeStamp * | pSrc | ||
) |
LIBCOM_API int epicsStdCall epicsTimeToTimespec | ( | struct timespec * | pDest, |
const epicsTimeStamp * | pSrc | ||
) |
LIBCOM_API int epicsStdCall epicsTimeToTimeval | ( | struct timeval * | pDest, |
const epicsTimeStamp * | pSrc | ||
) |
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.