This is Unofficial EPICS BASE Doxygen Site
epicsGeneralTime.c File Reference
#include <string.h>
#include <stdlib.h>
#include "epicsTypes.h"
#include "epicsEvent.h"
#include "epicsMutex.h"
#include "epicsMessageQueue.h"
#include "epicsString.h"
#include "epicsStdioRedirect.h"
#include "epicsThread.h"
#include "epicsTime.h"
#include "epicsTimer.h"
#include "epicsInterrupt.h"
#include "osiSock.h"
#include "ellLib.h"
#include "errlog.h"
#include "cantProceed.h"
#include "envDefs.h"
#include "generalTimeSup.h"
#include "epicsGeneralTime.h"
+ Include dependency graph for epicsGeneralTime.c:

Go to the source code of this file.

Classes

struct  gtProvider
 

Macros

#define IFDEBUG(n)   if(0) /* Compiler will elide the block or statement */
 

Functions

int osdTimeGetCurrent (epicsTimeStamp *pDest)
 
void generalTime_Init (void)
 Initialise the framework. More...
 
int generalTimeGetExceptPriority (epicsTimeStamp *pDest, int *pPrio, int ignore)
 
int epicsStdCall epicsTimeGetCurrent (epicsTimeStamp *pDest)
 Get current time into *pDest. More...
 
int epicsTimeGetMonotonic (epicsTimeStamp *pDest)
 Get monotonic time into *pDest. More...
 
int epicsTimeGetCurrentInt (epicsTimeStamp *pDest)
 Get current time into *pDest (ISR-safe) More...
 
int epicsStdCall epicsTimeGetEvent (epicsTimeStamp *pDest, int eventNumber)
 Get time of event eventNumber into *pDest. More...
 
int epicsTimeGetEventInt (epicsTimeStamp *pDest, int eventNumber)
 Get time of event eventNumber into *pDest (ISR-safe) More...
 
int generalTimeRegisterEventProvider (const char *name, int priority, TIMEEVENTFUN getEvent)
 
int generalTimeAddIntEventProvider (const char *name, int priority, TIMEEVENTFUN getEvent)
 
int generalTimeRegisterCurrentProvider (const char *name, int priority, TIMECURRENTFUN getTime)
 
int generalTimeAddIntCurrentProvider (const char *name, int priority, TIMECURRENTFUN getTime)
 
int installLastResortEventProvider (void)
 Install a Time Event time provider that returns the current time for any Time event number. More...
 
long generalTimeReport (int level)
 Provide information about the installed providers and their current best times. More...
 
void generalTimeResetErrorCounts (void)
 Reset the internal counter of the number of times the time returned was earlier than when previously requested. More...
 
int generalTimeGetErrorCounts (void)
 Return the internal counter of the number of times the time returned was earlier than when previously requested. More...
 
const char * generalTimeCurrentProviderName (void)
 Return the nume of the provider that last returned a valid current time, or NULL if none. More...
 
const char * generalTimeEventProviderName (void)
 Return the name of the provider that last returned a valid Time Event time, or NULL of none. More...
 
const char * generalTimeHighestCurrentName (void)
 Return the name of the registered current time provider that has the highest priority. More...
 

Macro Definition Documentation

#define IFDEBUG (   n)    if(0) /* Compiler will elide the block or statement */

Definition at line 41 of file epicsGeneralTime.c.

Function Documentation

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
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
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
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
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
void generalTime_Init ( void  )

Initialise the framework.

This routine is called automatically by any function that requires the framework. It does not need to be called explicitly.

Definition at line 99 of file epicsGeneralTime.c.

100 {
101  epicsThreadOnce(&onceId, generalTime_InitOnce, NULL);
102 }
#define NULL
Definition: catime.c:38
LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg)
int generalTimeAddIntCurrentProvider ( const char *  name,
int  priority,
TIMECURRENTFUN  getTime 
)

Definition at line 487 of file epicsGeneralTime.c.

489 {
490  gtProvider *ptp = findProvider(&gtPvt.timeProviders, gtPvt.timeListLock,
491  name, priority);
492  if (ptp == NULL)
493  return S_time_noProvider;
494 
495  ptp->getInt.Time = getTime;
496 
497  IFDEBUG(1)
498  printf("Time provider '%s' is interrupt-callable\n", name);
499 
500  return epicsTimeOK;
501 }
#define printf
Definition: epicsStdio.h:41
#define IFDEBUG(n)
union gtProvider::@16 getInt
#define NULL
Definition: catime.c:38
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
TIMECURRENTFUN Time
#define S_time_noProvider
No time provider.
Definition: epicsTime.h:341
int generalTimeAddIntEventProvider ( const char *  name,
int  priority,
TIMEEVENTFUN  getEvent 
)

Definition at line 444 of file epicsGeneralTime.c.

446 {
447  gtProvider *ptp = findProvider(&gtPvt.eventProviders, gtPvt.eventListLock,
448  name, priority);
449  if (ptp == NULL)
450  return S_time_noProvider;
451 
452  ptp->getInt.Event = getEvent;
453 
454  IFDEBUG(1)
455  printf("Event provider '%s' is interrupt-callable\n", name);
456 
457  return epicsTimeOK;
458 }
#define printf
Definition: epicsStdio.h:41
#define IFDEBUG(n)
union gtProvider::@16 getInt
#define NULL
Definition: catime.c:38
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
TIMEEVENTFUN Event
#define S_time_noProvider
No time provider.
Definition: epicsTime.h:341
const char* generalTimeCurrentProviderName ( void  )

Return the nume of the provider that last returned a valid current time, or NULL if none.

Used by stringin device support with:

1 DTYP = "General Time"
2 INP = "@BESTTCP"
Returns
Provider name

Definition at line 638 of file epicsGeneralTime.c.

639 {
640  if (gtPvt.lastTimeProvider)
641  return gtPvt.lastTimeProvider->name;
642  return NULL;
643 }
#define NULL
Definition: catime.c:38
const char* generalTimeEventProviderName ( void  )

Return the name of the provider that last returned a valid Time Event time, or NULL of none.

Used by stringin device support with:

1 DTYP = "General Time"
2 INP = "@BESTTEP"
Returns
Provider name

Definition at line 645 of file epicsGeneralTime.c.

646 {
647  if (gtPvt.lastEventProvider)
648  return gtPvt.lastEventProvider->name;
649  return NULL;
650 }
#define NULL
Definition: catime.c:38
int generalTimeGetErrorCounts ( void  )

Return the internal counter of the number of times the time returned was earlier than when previously requested.

Used by device support for longin record with:

1 DTYP = "General Time"
2 INP = "@GETERRCNT"
Returns
Reset error counts

Definition at line 630 of file epicsGeneralTime.c.

631 {
632  int key = epicsInterruptLock();
633  int errors = gtPvt.ErrorCounts;
635  return errors;
636 }
LIBCOM_API void epicsInterruptUnlock(int key)
Definition: osdInterrupt.c:41
LIBCOM_API int epicsInterruptLock(void)
Definition: osdInterrupt.c:34
int generalTimeGetExceptPriority ( epicsTimeStamp pDest,
int *  pPrio,
int  ignore 
)

Definition at line 105 of file epicsGeneralTime.c.

106 {
107  gtProvider *ptp;
109 
110  if(useOsdGetCurrent)
111  return osdTimeGetCurrent(pDest);
112 
114 
115  IFDEBUG(2)
116  printf("generalTimeGetExceptPriority(ignore=%d)\n", ignore);
117 
119  for (ptp = (gtProvider *)ellFirst(&gtPvt.timeProviders);
120  ptp; ptp = (gtProvider *)ellNext(&ptp->node)) {
121  if ((ignore > 0 && ptp->priority == ignore) ||
122  (ignore < 0 && ptp->priority != -ignore))
123  continue;
124 
125  status = ptp->get.Time(pDest);
126  if (status == epicsTimeOK) {
127  /* No ratchet, time from this routine may go backwards */
128  if (pPrio)
129  *pPrio = ptp->priority;
130  break;
131  }
132  else IFDEBUG(2)
133  printf("gTGExP provider '%s' returned error\n", ptp->name);
134  }
135  epicsMutexUnlock(gtPvt.timeListLock);
136 
137  IFDEBUG(2) {
138  if (ptp && status == epicsTimeOK) {
139  char buff[40];
140 
141  epicsTimeToStrftime(buff, sizeof(buff), tsfmt, pDest);
142  printf("gTGExP returning %s from provider '%s'\n",
143  buff, ptp->name);
144  }
145  else
146  printf("gTGExP returning error\n");
147  }
148 
149  return status;
150 }
epicsMutexId timeListLock
pvd::Status status
union gtProvider::@15 get
ELLLIST timeProviders
#define printf
Definition: epicsStdio.h:41
#define IFDEBUG(n)
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
Definition: epicsMutex.cpp:140
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
TIMECURRENTFUN Time
void generalTime_Init(void)
Initialise the framework.
#define S_time_noProvider
No time provider.
Definition: epicsTime.h:341
int generalTimeGetExceptPriority(epicsTimeStamp *pDest, int *pPrio, int ignore)
#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
const char* generalTimeHighestCurrentName ( void  )

Return the name of the registered current time provider that has the highest priority.

Used by stringin device support with:

1 DTYP = "General Time"
2 INP = "@TOPTCP"
Returns
Provider name

Definition at line 652 of file epicsGeneralTime.c.

653 {
654  gtProvider *ptp;
655 
656  epicsMutexMustLock(gtPvt.timeListLock);
657  ptp = (gtProvider *)ellFirst(&gtPvt.timeProviders);
658  epicsMutexUnlock(gtPvt.timeListLock);
659  return ptp ? ptp->name : NULL;
660 }
#define NULL
Definition: catime.c:38
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
Definition: epicsMutex.cpp:140
#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
int generalTimeRegisterCurrentProvider ( const char *  name,
int  priority,
TIMECURRENTFUN  getTime 
)

Definition at line 460 of file epicsGeneralTime.c.

462 {
463  gtProvider *ptp;
464 
466 
467  if (name == NULL || getTime == NULL)
468  return S_time_badArgs;
469 
470  ptp = (gtProvider *)malloc(sizeof(gtProvider));
471  if (ptp == NULL)
472  return S_time_noMemory;
473 
474  ptp->name = epicsStrDup(name);
475  ptp->priority = priority;
476  ptp->get.Time = getTime;
477  ptp->getInt.Time = NULL;
478 
479  insertProvider(ptp, &gtPvt.timeProviders, gtPvt.timeListLock);
480 
481  IFDEBUG(1)
482  printf("Registered time provider '%s' at %d\n", name, priority);
483 
484  return epicsTimeOK;
485 }
union gtProvider::@15 get
#define printf
Definition: epicsStdio.h:41
#define IFDEBUG(n)
union gtProvider::@16 getInt
#define NULL
Definition: catime.c:38
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_badArgs
Invalid arguments.
Definition: epicsTime.h:345
#define S_time_noMemory
Out of memory.
Definition: epicsTime.h:347
TIMECURRENTFUN Time
void generalTime_Init(void)
Initialise the framework.
char * epicsStrDup(const char *s)
Definition: epicsString.c:233
int generalTimeRegisterEventProvider ( const char *  name,
int  priority,
TIMEEVENTFUN  getEvent 
)

Definition at line 417 of file epicsGeneralTime.c.

419 {
420  gtProvider *ptp;
421 
423 
424  if (name == NULL || getEvent == NULL)
425  return S_time_badArgs;
426 
427  ptp = (gtProvider *)malloc(sizeof(gtProvider));
428  if (ptp == NULL)
429  return S_time_noMemory;
430 
431  ptp->name = epicsStrDup(name);
432  ptp->priority = priority;
433  ptp->get.Event = getEvent;
434  ptp->getInt.Event = NULL;
435 
436  insertProvider(ptp, &gtPvt.eventProviders, gtPvt.eventListLock);
437 
438  IFDEBUG(1)
439  printf("Registered event provider '%s' at %d\n", name, priority);
440 
441  return epicsTimeOK;
442 }
union gtProvider::@15 get
#define printf
Definition: epicsStdio.h:41
#define IFDEBUG(n)
union gtProvider::@16 getInt
#define NULL
Definition: catime.c:38
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
#define S_time_badArgs
Invalid arguments.
Definition: epicsTime.h:345
TIMEEVENTFUN Event
#define S_time_noMemory
Out of memory.
Definition: epicsTime.h:347
void generalTime_Init(void)
Initialise the framework.
char * epicsStrDup(const char *s)
Definition: epicsString.c:233
long generalTimeReport ( int  interest)

Provide information about the installed providers and their current best times.

Parameters
interestDesired interest level to report

Definition at line 529 of file epicsGeneralTime.c.

530 {
531  int items;
532 
533  if (onceId == EPICS_THREAD_ONCE_INIT) {
534  printf("General time framework not yet initialized.\n");
535  return epicsTimeOK;
536  }
537 
538  printf("Backwards time errors prevented %u times.\n\n",
540 
541  /* Use an output buffer to avoid holding mutexes during printing */
542 
543  printf("Current Time Providers:\n");
544  epicsMutexMustLock(gtPvt.timeListLock);
545  if ((items = ellCount(&gtPvt.timeProviders))) {
546  gtProvider *ptp;
547  char *message; /* Temporary output buffer */
548  char *pout;
549 
550  message = calloc(items, 80 * 2); /* Each provider needs 2 lines */
551  if (!message) {
552  epicsMutexUnlock(gtPvt.timeListLock);
553  printf("Out of memory\n");
554  return S_time_noMemory;
555  }
556 
557  pout = message;
558 
559  for (ptp = (gtProvider *)ellFirst(&gtPvt.timeProviders);
560  ptp; ptp = (gtProvider *)ellNext(&ptp->node)) {
561  pout += sprintf(pout, " \"%s\", priority = %d\n",
562  ptp->name, ptp->priority);
563  if (level) {
564  epicsTimeStamp tempTS;
565  if (ptp->get.Time(&tempTS) == epicsTimeOK) {
566  char tempTSText[40];
567  epicsTimeToStrftime(tempTSText, sizeof(tempTSText),
568  "%Y-%m-%d %H:%M:%S.%06f", &tempTS);
569  pout += sprintf(pout, "\tCurrent Time is %s.\n",
570  tempTSText);
571  } else {
572  pout += sprintf(pout, "\tCurrent Time not available\n");
573  }
574  }
575  }
576  epicsMutexUnlock(gtPvt.timeListLock);
577  puts(message);
578  free(message);
579  } else {
580  epicsMutexUnlock(gtPvt.timeListLock);
581  printf("\tNo Providers registered.\n");
582  }
583 
584  printf("Event Time Providers:\n");
585  epicsMutexMustLock(gtPvt.eventListLock);
586  if ((items = ellCount(&gtPvt.eventProviders)))
587  {
588  gtProvider *ptp;
589  char *message; /* Temporary output buffer */
590  char *pout;
591 
592  message = calloc(items, 80); /* Each provider needs 1 line, */
593  if (!message) {
594  epicsMutexUnlock(gtPvt.eventListLock);
595  printf("Out of memory\n");
596  return S_time_noMemory;
597  }
598 
599  pout = message;
600 
601  for (ptp = (gtProvider *)ellFirst(&gtPvt.eventProviders);
602  ptp; ptp = (gtProvider *)ellNext(&ptp->node)) {
603  pout += sprintf(pout, " \"%s\", priority = %d\n",
604  ptp->name, ptp->priority);
605  }
606  epicsMutexUnlock(gtPvt.eventListLock);
607  puts(message);
608  free(message);
609  }
610  else
611  {
612  epicsMutexUnlock(gtPvt.eventListLock);
613  printf("\tNo Providers registered.\n");
614  }
615 
616  return epicsTimeOK;
617 }
#define ellCount(PLIST)
Report the number of nodes in a list.
Definition: ellLib.h:84
union gtProvider::@15 get
#define printf
Definition: epicsStdio.h:41
#define epicsTimeOK
Success.
Definition: epicsTime.h:339
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
Definition: epicsMutex.cpp:140
#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
#define EPICS_THREAD_ONCE_INIT
Definition: epicsThread.h:109
#define puts
Definition: epicsStdio.h:46
#define S_time_noMemory
Out of memory.
Definition: epicsTime.h:347
TIMECURRENTFUN Time
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
Definition: epicsMutex.h:214
int generalTimeGetErrorCounts(void)
Return the internal counter of the number of times the time returned was earlier than when previously...
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
void generalTimeResetErrorCounts ( void  )

Reset the internal counter of the number of times the time returned was earlier than when previously requested.

Used by device support for binary out record with:

1 DTYP = "General Time"
2 OUT = "@RSTERRCNT"

Definition at line 623 of file epicsGeneralTime.c.

624 {
625  int key = epicsInterruptLock();
626  gtPvt.ErrorCounts = 0;
628 }
LIBCOM_API void epicsInterruptUnlock(int key)
Definition: osdInterrupt.c:41
LIBCOM_API int epicsInterruptLock(void)
Definition: osdInterrupt.c:34
int installLastResortEventProvider ( void  )

Install a Time Event time provider that returns the current time for any Time event number.

Note
This is optional as it is site policy whether the last resort for a Time Event time in the absence of any working provider should be a failure, or the current time.

Definition at line 520 of file epicsGeneralTime.c.

521 {
522  return generalTimeEventTpRegister("Last Resort Event",
523  LAST_RESORT_PRIORITY, lastResortGetEvent);
524 }
#define generalTimeEventTpRegister
#define LAST_RESORT_PRIORITY
int osdTimeGetCurrent ( epicsTimeStamp pDest)

Definition at line 119 of file osdTime.cpp.

120 {
121  assert ( pCurrentTime );
122 
123  pCurrentTime->getCurrentTime ( *pDest );
124  return epicsTimeOK;
125 }
#define assert(exp)
Declare that a condition should be true.
Definition: epicsAssert.h:70
void getCurrentTime(epicsTimeStamp &dest)
Definition: osdTime.cpp:238
#define epicsTimeOK
Success.
Definition: epicsTime.h:339

Variable Documentation

int ErrorCounts

Definition at line 73 of file epicsGeneralTime.c.

epicsMutexId eventListLock

Definition at line 67 of file epicsGeneralTime.c.

ELLLIST eventProviders

Definition at line 68 of file epicsGeneralTime.c.

Definition at line 70 of file epicsGeneralTime.c.

gtProvider* lastEventProvider

Definition at line 69 of file epicsGeneralTime.c.

epicsTimeStamp lastProvidedBestTime

Definition at line 71 of file epicsGeneralTime.c.

epicsTimeStamp lastProvidedTime

Definition at line 65 of file epicsGeneralTime.c.

gtProvider* lastTimeProvider

Definition at line 64 of file epicsGeneralTime.c.

epicsMutexId timeListLock

Definition at line 62 of file epicsGeneralTime.c.

ELLLIST timeProviders

Definition at line 63 of file epicsGeneralTime.c.