Fix Darwin build, which doesn't have CLOCK_REALTIME.
This commit is contained in:
@@ -24,6 +24,11 @@
|
||||
|
||||
#define TIME_INIT ClockTime_Init(CLOCKTIME_NOSYNC)
|
||||
#else
|
||||
/* Some posix systems like Darwin don't have CLOCK_REALTIME */
|
||||
|
||||
#define TIME_INIT generalTimeCurrentTpRegister("GetTimeOfDay", \
|
||||
LAST_RESORT_PRIORITY, osdTimeGetCurrent)
|
||||
|
||||
extern "C" {
|
||||
static int osdTimeGetCurrent (epicsTimeStamp *pDest)
|
||||
{
|
||||
@@ -37,9 +42,6 @@
|
||||
return epicsTimeOK;
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
#define TIME_INIT generalTimeCurrentTpRegister("GetTimeOfDay", \
|
||||
LAST_RESORT_PRIORITY, osdTimeGetCurrent)
|
||||
#endif
|
||||
|
||||
static int timeRegister(void)
|
||||
|
||||
@@ -37,6 +37,12 @@ static struct {
|
||||
static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT;
|
||||
|
||||
|
||||
#ifdef CLOCK_REALTIME
|
||||
/* This code is not used on systems without Posix CLOCK_REALTIME such
|
||||
* as Darwin, but the only way to detect that is from the OS headers,
|
||||
* so the Makefile can't exclude building this file on those systems.
|
||||
*/
|
||||
|
||||
/* Forward references */
|
||||
|
||||
static int ClockTimeGetCurrent(epicsTimeStamp *pDest);
|
||||
@@ -147,7 +153,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_HD, &clockNow) &&
|
||||
clock_gettime(CLOCK_REALTIME_HR, &clockNow) &&
|
||||
#endif
|
||||
clock_gettime(CLOCK_REALTIME, &clockNow);
|
||||
|
||||
@@ -165,6 +171,11 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest)
|
||||
}
|
||||
|
||||
|
||||
#endif /* CLOCK_REALTIME */
|
||||
/* Allow the following report routine to be compiled anyway
|
||||
* to avoid getting a build warning from ranlib.
|
||||
*/
|
||||
|
||||
/* Status Report */
|
||||
|
||||
int ClockTime_Report(int level)
|
||||
|
||||
Reference in New Issue
Block a user