diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-04-06 12:21:14 +0900 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-04-06 12:21:14 +0900 |
commit | abea280dd3df0c0f6d67a930eb2ffe5b73255fa9 (patch) | |
tree | 976c97df968520e73fd3f869490cf51c0c5100d1 /contrib | |
parent | Merge pull request #787 (diff) | |
parent | Fix get_tick_count() on Windows (diff) | |
download | monero-abea280dd3df0c0f6d67a930eb2ffe5b73255fa9.tar.xz |
Merge pull request #799
aaaf9e2 Fix get_tick_count() on Windows (Howard Chu)
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/misc_os_dependent.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/epee/include/misc_os_dependent.h b/contrib/epee/include/misc_os_dependent.h index 2abca0446..806d3e83e 100644 --- a/contrib/epee/include/misc_os_dependent.h +++ b/contrib/epee/include/misc_os_dependent.h @@ -53,11 +53,13 @@ namespace misc_utils #if defined(_MSC_VER) return ::GetTickCount64(); #elif defined(WIN32) -# if defined(WIN64) - return GetTickCount64(); -# else - return GetTickCount(); -# endif + static LARGE_INTEGER pcfreq = {0}; + LARGE_INTEGER ticks; + if (!pcfreq.QuadPart) + QueryPerformanceFrequency(&pcfreq); + QueryPerformanceCounter(&ticks); + ticks.QuadPart *= 1000; /* we want msec */ + return ticks.QuadPart / pcfreq.QuadPart; #elif defined(__MACH__) clock_serv_t cclock; mach_timespec_t mts; |