summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-24 16:03:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-10-24 16:03:28 +0200
commit0d0a0c2f8aa1eb2dfce3830b931a18d14662c8aa (patch)
tree324a290342154c38c6015d53375988a5cc2eac02 /opentrack-compat
parent1ed0822c27d06043a2730b652a195f37b8e57b17 (diff)
timer: guard against overflow on win32
Diffstat (limited to 'opentrack-compat')
-rw-r--r--opentrack-compat/timer.hpp4
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;