Fallback to reading CLOCK_MONOTONIC_RAW, if available.

This commit is contained in:
Bartosz Taudul 2019-03-21 21:49:23 +01:00
parent 3ccb831efb
commit 7f57b3dba9

View File

@ -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::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
# endif
}
int64_t GetTimeImplCntvct()