diff --git a/src/simulator/wall-clock-synchronizer.cc b/src/simulator/wall-clock-synchronizer.cc index 32264b6a7..3ba9b8828 100644 --- a/src/simulator/wall-clock-synchronizer.cc +++ b/src/simulator/wall-clock-synchronizer.cc @@ -429,6 +429,7 @@ WallClockSynchronizer::GetNormalizedRealtime (void) return GetRealtime () - m_realtimeOriginNano; } +#ifdef CLOCK_REALTIME void WallClockSynchronizer::NsToTimespec (int64_t ns, struct timespec *ts) { @@ -436,6 +437,7 @@ WallClockSynchronizer::NsToTimespec (int64_t ns, struct timespec *ts) ts->tv_sec = ns / NS_PER_SEC; ts->tv_nsec = ns % NS_PER_SEC; } +#endif void WallClockSynchronizer::NsToTimeval (int64_t ns, struct timeval *tv) @@ -445,6 +447,7 @@ WallClockSynchronizer::NsToTimeval (int64_t ns, struct timeval *tv) tv->tv_usec = (ns % NS_PER_SEC) / US_PER_NS; } +#ifdef CLOCK_REALTIME uint64_t WallClockSynchronizer::TimespecToNs (struct timespec *ts) { @@ -452,6 +455,7 @@ WallClockSynchronizer::TimespecToNs (struct timespec *ts) NS_ASSERT ((nsResult % US_PER_NS) == 0); return nsResult; } +#endif uint64_t WallClockSynchronizer::TimevalToNs (struct timeval *tv) @@ -461,6 +465,7 @@ WallClockSynchronizer::TimevalToNs (struct timeval *tv) return nsResult; } +#ifdef CLOCK_REALTIME void WallClockSynchronizer::TimespecAdd ( struct timespec *ts1, @@ -475,6 +480,7 @@ WallClockSynchronizer::TimespecAdd ( result->tv_nsec %= NS_PER_SEC; } } +#endif void WallClockSynchronizer::TimevalAdd ( diff --git a/src/simulator/wall-clock-synchronizer.h b/src/simulator/wall-clock-synchronizer.h index ff961b6e0..1510547c8 100644 --- a/src/simulator/wall-clock-synchronizer.h +++ b/src/simulator/wall-clock-synchronizer.h @@ -175,16 +175,22 @@ protected: uint64_t GetRealtime (void); uint64_t GetNormalizedRealtime (void); +#ifdef CLOCK_REALTIME void NsToTimespec (int64_t ns, struct timespec *ts); +#endif void NsToTimeval (int64_t ns, struct timeval *tv); +#ifdef CLOCK_REALTIME uint64_t TimespecToNs (struct timespec *ts); +#endif uint64_t TimevalToNs (struct timeval *tv); +#ifdef CLOCK_REALTIME void TimespecAdd( struct timespec *ts1, struct timespec *ts2, struct timespec *result); +#endif void TimevalAdd ( struct timeval *tv1,