From 2760dedc52e2650762b752892e48322cfa3d8bdc Mon Sep 17 00:00:00 2001 From: Osyotr Date: Mon, 18 Mar 2024 01:16:59 +0300 Subject: [PATCH] Replace platform-dependent timer code with std::chrono Signed-off-by: Osyotr --- base/timer.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/base/timer.cpp b/base/timer.cpp index 9c7bcf8d26..61c15d13e4 100644 --- a/base/timer.cpp +++ b/base/timer.cpp @@ -15,28 +15,13 @@ #include // std::get_time #include -#include - namespace base { // static double Timer::LocalTime() { - /// @todo duration_cast(system_clock::now().time_since_epoch()).count() ? - -#ifdef OMIM_OS_WINDOWS_NATIVE - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - uint64_t val = ft.dwHighDateTime; - val <<= 32; - val += ft.dwLowDateTime; - return val / 10000000.0; - -#else - timeval tv; - ::gettimeofday(&tv, 0); - return tv.tv_sec + tv.tv_usec / 1000000.0; -#endif + auto const now = std::chrono::system_clock::now(); + return std::chrono::duration(now.time_since_epoch()).count(); } std::string FormatCurrentTime()