diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-24 16:03:28 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-24 16:03:28 +0200 |
commit | 0d0a0c2f8aa1eb2dfce3830b931a18d14662c8aa (patch) | |
tree | 324a290342154c38c6015d53375988a5cc2eac02 /opentrack-compat/timer.hpp | |
parent | 1ed0822c27d06043a2730b652a195f37b8e57b17 (diff) |
timer: guard against overflow on win32
Diffstat (limited to 'opentrack-compat/timer.hpp')
-rw-r--r-- | opentrack-compat/timer.hpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/opentrack-compat/timer.hpp b/opentrack-compat/timer.hpp index 1d424832..f0741295 100644 --- a/opentrack-compat/timer.hpp +++ b/opentrack-compat/timer.hpp @@ -24,9 +24,7 @@ static inline void opentrack_clock_gettime(int, struct timespec* ts) (void) QueryPerformanceCounter(&d); - long long part = d.QuadPart; - part *= 1000000000ULL; - part /= freq.QuadPart; + long long part = d.QuadPart / ((long double)freq.QuadPart) * 1000000000.L; ts->tv_sec = part / 1000000000ULL; ts->tv_nsec = part % 1000000000ULL; |