From 7f57b3dba9babaa1f4a7c66db0fec09afb688682 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 21 Mar 2019 21:49:23 +0100 Subject: [PATCH] Fallback to reading CLOCK_MONOTONIC_RAW, if available. --- client/TracyProfiler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 519903ca..3971b1f4 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -148,7 +148,13 @@ int64_t (*GetTimeImpl)(); int64_t GetTimeImplFallback() { +# ifdef CLOCK_MONOTONIC_RAW + struct timespec ts; + clock_gettime( CLOCK_MONOTONIC_RAW, &ts ); + return int64_t( ts.tv_sec ) * 1000000000 + int64_t( ts.tv_nsec ); +# else return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); +# endif } int64_t GetTimeImplCntvct()