summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-10 07:11:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-10 07:11:28 +0200
commit77075f6ba554a9c40b7e364e16d25e87c8bfca43 (patch)
treec775eeb7fd39b181970c5e1f350bc2ee5b679545 /opentrack-compat
parent62a721226d5e08f57f1bda12a7f570be6be77635 (diff)
compat/timer: cleanup harmless warnings
Diffstat (limited to 'opentrack-compat')
-rw-r--r--opentrack-compat/timer.hpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/opentrack-compat/timer.hpp b/opentrack-compat/timer.hpp
index 0bcb88a6..4f7e8d2e 100644
--- a/opentrack-compat/timer.hpp
+++ b/opentrack-compat/timer.hpp
@@ -24,10 +24,13 @@ static inline void opentrack_clock_gettime(int, struct timespec* ts)
(void) QueryPerformanceCounter(&d);
- long long part = d.QuadPart / ((long double)freq.QuadPart) * 1000000000.L;
+ using t = long long;
+ const long long part = t(d.QuadPart / ((long double)freq.QuadPart) * 1000000000.L);
+ using t_s = decltype(ts->tv_sec);
+ using t_ns = decltype(ts->tv_nsec);
- ts->tv_sec = part / 1000000000ULL;
- ts->tv_nsec = part % 1000000000ULL;
+ ts->tv_sec = t_s(part / 1000000000LL);
+ ts->tv_nsec = t_ns(part % 1000000000LL);
}
# define clock_gettime opentrack_clock_gettime
#else
@@ -61,15 +64,15 @@ public:
start();
}
void start() {
- (void) clock_gettime(CLOCK_MONOTONIC, &state);
+ clock_gettime(CLOCK_MONOTONIC, &state);
}
long long elapsed() const {
struct timespec cur;
- (void) clock_gettime(CLOCK_MONOTONIC, &cur);
+ clock_gettime(CLOCK_MONOTONIC, &cur);
return conv(cur);
}
long elapsed_ms() const {
- return elapsed() / 1000000L;
+ return long(elapsed() / 1000000LL);
}
double elapsed_seconds() const
{