diff options
author | Andrew Stitcher <astitcher@apache.org> | 2014-07-01 16:55:43 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2014-07-01 16:55:43 +0000 |
commit | b2bd2715e9b15271fb051e594f8bd141cf4b073a (patch) | |
tree | 005d33c3a0292af64d0c528874a11e8612a05f6d /qpid/cpp/src/tests | |
parent | ea3eadaf0f332988da797cc66d6534dc2ee4ee1e (diff) | |
download | qpid-python-b2bd2715e9b15271fb051e594f8bd141cf4b073a.tar.gz |
QPID-5865: Be more robust in face of system clock being changed:
- Separate Wall clock time uses from other time
* (assumed that any time with respect to the epoch is wallclock)
- For Posix use CLOCK_MONOTONIC for all non wall clock purposes
so that changing system time doesn't affect internal timekeeping
- For Windows kept the same time keeping scheme.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1607140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
-rw-r--r-- | qpid/cpp/src/tests/Statistics.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/tests/echotest.cpp | 3 | ||||
-rw-r--r-- | qpid/cpp/src/tests/qpid-latency-test.cpp | 5 | ||||
-rw-r--r-- | qpid/cpp/src/tests/qpid-send.cpp | 2 |
4 files changed, 5 insertions, 7 deletions
diff --git a/qpid/cpp/src/tests/Statistics.cpp b/qpid/cpp/src/tests/Statistics.cpp index 19531762b1..7cacde8b74 100644 --- a/qpid/cpp/src/tests/Statistics.cpp +++ b/qpid/cpp/src/tests/Statistics.cpp @@ -64,7 +64,7 @@ void ThroughputAndLatency::message(const messaging::Message& m) { if (i != m.getProperties().end()) { ++samples; int64_t start(i->second.asInt64()); - int64_t end(sys::Duration(sys::EPOCH, sys::now())); + int64_t end(sys::Duration::FromEpoch()); double latency = double(end - start)/sys::TIME_MSEC; if (latency > 0) { total += latency; diff --git a/qpid/cpp/src/tests/echotest.cpp b/qpid/cpp/src/tests/echotest.cpp index 5114ab883d..7c30989098 100644 --- a/qpid/cpp/src/tests/echotest.cpp +++ b/qpid/cpp/src/tests/echotest.cpp @@ -64,8 +64,7 @@ struct Args : public qpid::Options, uint64_t current_time() { - Duration t(EPOCH, now()); - return t; + return Duration::FromEpoch(); } class Listener : public MessageListener diff --git a/qpid/cpp/src/tests/qpid-latency-test.cpp b/qpid/cpp/src/tests/qpid-latency-test.cpp index ba53ba0459..a03963467b 100644 --- a/qpid/cpp/src/tests/qpid-latency-test.cpp +++ b/qpid/cpp/src/tests/qpid-latency-test.cpp @@ -97,8 +97,7 @@ Connection globalConnection; uint64_t current_time() { - Duration t(EPOCH, now()); - return t; + return Duration::FromEpoch(); } struct Stats @@ -364,7 +363,7 @@ void Sender::sendByRate() AbsTime last = start; while (true) { AbsTime sentAt=now(); - msg.getDeliveryProperties().setTimestamp(Duration(EPOCH, sentAt)); + msg.getDeliveryProperties().setTimestamp(Duration::FromEpoch()); async(session).messageTransfer(arg::content=msg, arg::acceptMode=1); if (opts.sync) session.sync(); ++sent; diff --git a/qpid/cpp/src/tests/qpid-send.cpp b/qpid/cpp/src/tests/qpid-send.cpp index 78702f7a85..71ce1e32bb 100644 --- a/qpid/cpp/src/tests/qpid-send.cpp +++ b/qpid/cpp/src/tests/qpid-send.cpp @@ -409,7 +409,7 @@ int main(int argc, char ** argv) if (opts.timestamp) msg.getProperties()[TS] = int64_t( - qpid::sys::Duration(qpid::sys::EPOCH, qpid::sys::now())); + qpid::sys::Duration::FromEpoch()); sender.send(msg); reporter.message(msg); |