mirror of
https://github.com/alexbatalov/fallout2-ce.git
synced 2024-09-15 15:03:11 +00:00
Fix timeGetTime on Linux
This commit is contained in:
parent
2e7070a942
commit
0819937e56
@ -21,7 +21,7 @@
|
||||
#ifdef _WIN32
|
||||
#include <timeapi.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <chrono>
|
||||
#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<unsigned int>(std::chrono::duration_cast<std::chrono::milliseconds>(now - start).count());
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user