From 15766219de7fc6ec8a4968e284b81bfbe10cc880 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 28 Aug 2008 15:06:49 -0700 Subject: [PATCH] don't assume posix compatibility means posix clocks --- src/simulator/wall-clock-synchronizer.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/simulator/wall-clock-synchronizer.cc b/src/simulator/wall-clock-synchronizer.cc index 2016b357d..32264b6a7 100644 --- a/src/simulator/wall-clock-synchronizer.cc +++ b/src/simulator/wall-clock-synchronizer.cc @@ -56,11 +56,17 @@ WallClockSynchronizer::WallClockSynchronizer () // requires a delay less than a jiffy. This is on the order of one millisecond // (999848 ns) on the ns-regression machine. // +// If the underlying OS does not support posix clocks, we'll just assume a +// one millisecond quantum and deal with this as best we can + +#ifdef CLOCK_REALTIME struct timespec ts; clock_getres (CLOCK_REALTIME, &ts); m_jiffy = ts.tv_sec * NS_PER_SEC + ts.tv_nsec; NS_LOG_INFO ("Jiffy is " << m_jiffy << " ns"); - +#else + m_jiffy = 1000000; +#endif #if 0 // // DANGER DANGER WILL ROBINSON