From 58d4242b68a25a82223265d53554977532383f06 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 17 Aug 2018 13:09:33 -0500 Subject: [PATCH] osiClockTime: Only call clock_setting() on embedded OSs An update to Apple's XCode broke the iOS build because they have added Posix CLOCK_REALTIME support since this code was written and now if you compile a call to clock_settime() it stops the build. --- src/libCom/osi/osiClockTime.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libCom/osi/osiClockTime.c b/src/libCom/osi/osiClockTime.c index 1463ee551..8d8cb2606 100644 --- a/src/libCom/osi/osiClockTime.c +++ b/src/libCom/osi/osiClockTime.c @@ -159,6 +159,7 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest) /* If a Hi-Res clock is available and works, use it */ #ifdef CLOCK_REALTIME_HR clock_gettime(CLOCK_REALTIME_HR, &clockNow) && + /* Note: Uses the lo-res clock below if the above call fails */ #endif clock_gettime(CLOCK_REALTIME, &clockNow); @@ -166,9 +167,15 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest) clockNow.tv_sec < POSIX_TIME_AT_EPICS_EPOCH) { clockNow.tv_sec = POSIX_TIME_AT_EPICS_EPOCH + 86400; clockNow.tv_nsec = 0; + +#if defined(vxWorks) || defined(__rtems__) clock_settime(CLOCK_REALTIME, &clockNow); errlogPrintf("WARNING: OS Clock time was read before being set.\n" "Using 1990-01-02 00:00:00.000000 UTC\n"); +#else + errlogPrintf("WARNING: OS Clock pre-dates the EPICS epoch!\n" + "Using 1990-01-02 00:00:00.000000 UTC\n"); +#endif } epicsTimeFromTimespec(pDest, &clockNow);