GeneralTime updates to improve time provider synchronization
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "epicsThread.h"
|
||||
#include "epicsPrint.h"
|
||||
#include "ellLib.h"
|
||||
#include "epicsGeneralTime.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbBase.h"
|
||||
#include "caeventmask.h"
|
||||
@@ -69,6 +70,7 @@ static enum {
|
||||
|
||||
/* define forward references*/
|
||||
static int checkDatabase(dbBase *pdbbase);
|
||||
static void checkGeneralTime(void);
|
||||
static void initDrvSup(void);
|
||||
static void initRecSup(void);
|
||||
static void initDevSup(void);
|
||||
@@ -110,6 +112,7 @@ int iocBuild(void)
|
||||
/* After this point, further calls to iocInit() are disallowed. */
|
||||
iocState = iocBuilding;
|
||||
|
||||
checkGeneralTime();
|
||||
taskwdInit();
|
||||
callbackInit();
|
||||
initHookAnnounce(initHookAfterCallbackInit);
|
||||
@@ -281,6 +284,22 @@ static int checkDatabase(dbBase *pdbbase)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void checkGeneralTime(void)
|
||||
{
|
||||
epicsTimeStamp ts;
|
||||
|
||||
epicsTimeGetCurrent(&ts);
|
||||
if (ts.secPastEpoch < 2*24*60*60) {
|
||||
static const char * const tsfmt = "%Y-%m-%d %H:%M:%S.%09f";
|
||||
char buff[40];
|
||||
|
||||
epicsTimeToStrftime(buff, sizeof(buff), tsfmt, &ts);
|
||||
errlogPrintf("iocInit: Time provider has not yet synchronized.\n");
|
||||
}
|
||||
|
||||
epicsTimeGetEvent(&ts, 1); /* Prime gtPvt.lastEventProvider for ISRs */
|
||||
}
|
||||
|
||||
|
||||
static void initDrvSup(void) /* Locate all driver support entry tables */
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user