From a9034bb5860fb46bb094ca2cd02ba3f4135b43b9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 7 Mar 2020 00:40:13 -0600 Subject: [PATCH] Fix clock_gettime issue on newer MinGW builds Fixes lp: #1853168 --- src/libCom/osi/osiClockTime.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libCom/osi/osiClockTime.c b/src/libCom/osi/osiClockTime.c index 01958b20e..d9dff13a2 100644 --- a/src/libCom/osi/osiClockTime.c +++ b/src/libCom/osi/osiClockTime.c @@ -41,7 +41,7 @@ static struct { static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT; -#ifdef CLOCK_REALTIME +#if defined(CLOCK_REALTIME) && !defined(_WIN32) /* This code is not used on systems without Posix CLOCK_REALTIME, * but the only way to detect that is from the OS headers, so the * Makefile can't exclude compiling this file on those systems. @@ -229,7 +229,11 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest) return 0; } -#endif /* CLOCK_REALTIME */ +/* Used in Report function below: */ +#define UNINIT_ERROR "initialized" +#else +#define UNINIT_ERROR "available" +#endif /* CLOCK_REALTIME && !WIN32 */ /* Allow the following report routine to be compiled anyway * to avoid getting a build warning from ranlib. @@ -242,13 +246,7 @@ int ClockTime_Report(int level) char timebuf[32]; if (onceId == EPICS_THREAD_ONCE_INIT) { - printf("OS Clock driver not %s.\n", -#ifdef CLOCK_REALTIME - "initialized" -#else - "available" -#endif /* CLOCK_REALTIME */ - ); + puts("OS Clock driver not " UNINIT_ERROR); } else if (ClockTimePvt.synchronize == CLOCKTIME_SYNC) { int synchronized, syncFromPriority;