summaryrefslogtreecommitdiff
path: root/cpp/include
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-09-05 14:44:03 -0230
committerDwayne Boone <dwayne@zeroc.com>2007-09-05 14:44:03 -0230
commitbdcf4f222f50b915d2dfc0ea3960758adf6937db (patch)
treee263a048b6297395c97e860c87a0ca27b569cb08 /cpp/include
parentAdded missing file (diff)
downloadice-bdcf4f222f50b915d2dfc0ea3960758adf6937db.tar.bz2
ice-bdcf4f222f50b915d2dfc0ea3960758adf6937db.tar.xz
ice-bdcf4f222f50b915d2dfc0ea3960758adf6937db.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1351 - use monotonic timers where possible
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/IceUtil/Cond.h2
-rw-r--r--cpp/include/IceUtil/Time.h6
2 files changed, 6 insertions, 2 deletions
diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h
index f7b192c300d..dde7d3082a0 100644
--- a/cpp/include/IceUtil/Cond.h
+++ b/cpp/include/IceUtil/Cond.h
@@ -223,7 +223,7 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const
LockState state;
mutex.unlock(state);
- timeval tv = Time::now() + timeout;
+ timeval tv = Time::now(Time::Monotonic) + timeout;
timespec ts;
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = tv.tv_usec * 1000;
diff --git a/cpp/include/IceUtil/Time.h b/cpp/include/IceUtil/Time.h
index b2b5981776a..60e87501031 100644
--- a/cpp/include/IceUtil/Time.h
+++ b/cpp/include/IceUtil/Time.h
@@ -29,7 +29,8 @@ public:
// automatically generated copy constructor and assignment
// operator do the right thing.
- static Time now();
+ enum Clock { Realtime, Monotonic };
+ static Time now(Clock = Realtime);
static Time seconds(Int64);
static Time milliSeconds(Int64);
static Time microSeconds(Int64);
@@ -194,6 +195,9 @@ private:
Time(Int64);
Int64 _usec;
+#ifdef _WIN32
+ static Int64 _frequency;
+#endif
};
ICE_UTIL_API std::ostream& operator<<(std::ostream&, const Time&);