diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-10-16 14:48:06 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-10-16 14:48:06 +0200 |
commit | 61d38fbeed89d69516b9976c60b7711fefed6411 (patch) | |
tree | a8e69e1f2b3ac99bb1a6194f024e422eaba8c22f | |
parent | 0a03e86e9547fa7c221b316a5a943467adea3dfd (diff) |
Bug in low precision clock fixed.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | src/clock.cpp | 4 | ||||
-rw-r--r-- | src/clock.hpp | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/clock.cpp b/src/clock.cpp index 2fa23d0..432b48e 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -31,7 +31,7 @@ zmq::clock_t::clock_t () : last_tsc (rdtsc ()), - last_time (now_us ()) + last_time (now_us () / 1000) { } @@ -82,7 +82,7 @@ uint64_t zmq::clock_t::now_ms () return last_time; last_tsc = tsc; - last_time = now_us (); + last_time = now_us () / 1000; return last_time; } diff --git a/src/clock.hpp b/src/clock.hpp index 8b3bc75..6dc811f 100644 --- a/src/clock.hpp +++ b/src/clock.hpp @@ -44,7 +44,10 @@ namespace zmq private: + // TSC timestamp of when last time measurement was made. uint64_t last_tsc; + + // Physical time corresponding to the TSC above (in milliseconds). uint64_t last_time; clock_t (const clock_t&); |