From 80b7e04bc678838532f8a6d95e7379ef0f9e1af0 Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Tue, 11 Sep 2018 10:51:36 -0700 Subject: [PATCH] Revert change to chrono for usecTimestampNow() --- libraries/shared/src/SharedUtil.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index 6c79a23c20..e52e815520 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -128,15 +128,11 @@ void usecTimestampNowForceClockSkew(qint64 clockSkew) { ::usecTimestampNowAdjust = clockSkew; } -//static std::atomic TIME_REFERENCE { 0 }; // in usec -//static std::once_flag usecTimestampNowIsInitialized; -//static QElapsedTimer timestampTimer; +static std::atomic TIME_REFERENCE { 0 }; // in usec +static std::once_flag usecTimestampNowIsInitialized; +static QElapsedTimer timestampTimer; quint64 usecTimestampNow(bool wantDebug) { - using namespace std::chrono; - static const auto unixEpoch = system_clock::from_time_t(0); - return duration_cast(system_clock::now() - unixEpoch).count(); -#if 0 std::call_once(usecTimestampNowIsInitialized, [&] { TIME_REFERENCE = QDateTime::currentMSecsSinceEpoch() * USECS_PER_MSEC; // ms to usec timestampTimer.start(); @@ -208,7 +204,6 @@ quint64 usecTimestampNow(bool wantDebug) { } return now; -#endif } float secTimestampNow() {