Fix Darwin build, which doesn't have CLOCK_REALTIME.

This commit is contained in:
Andrew Johnson
2008-09-15 14:55:19 +00:00
parent 70dfa451d2
commit ac69ccbff7
2 changed files with 17 additions and 4 deletions

View File

@@ -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)

View File

@@ -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)