From 0819937e56a2e644c7f9e28862dbfc51e954254c Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Thu, 2 Jun 2022 21:11:23 +0300 Subject: [PATCH] Fix timeGetTime on Linux --- src/platform_compat.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platform_compat.cc b/src/platform_compat.cc index b71be7b..69da2c5 100644 --- a/src/platform_compat.cc +++ b/src/platform_compat.cc @@ -21,7 +21,7 @@ #ifdef _WIN32 #include #else -#include +#include #endif int compat_stricmp(const char* string1, const char* string2) @@ -145,8 +145,8 @@ unsigned int compat_timeGetTime() #ifdef _WIN32 return timeGetTime(); #else - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_usec / 1000; + static auto start = std::chrono::steady_clock::now(); + auto now = std::chrono::steady_clock::now(); + return static_cast(std::chrono::duration_cast(now - start).count()); #endif }