diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-04-28 21:36:54 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-04-28 21:36:54 +0200 |
commit | fba47374dcbb12ffb168e2b2563d25b8e00b1d45 (patch) | |
tree | bb7c9c340a206ad562bd9d65b40730b882dbda37 /compat | |
parent | eb1c52f5f31aaeb218e48b9fb03069fe8d596f5a (diff) |
compat/timer: simplify
That long double cast shouldn't exist though.
Diffstat (limited to 'compat')
-rw-r--r-- | compat/timer.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compat/timer.cpp b/compat/timer.cpp index a555018c..55eb200d 100644 --- a/compat/timer.cpp +++ b/compat/timer.cpp @@ -80,13 +80,9 @@ void Timer::gettime(timespec* ts) BOOL ret = QueryPerformanceCounter(&d); assert(ret && "QueryPerformanceCounter failed"); - using ll = long long; - auto part = ll(std::roundl((d.QuadPart * 1000000000.L) / freq)); - using t_s = decltype(ts->tv_sec); - using t_ns = decltype(ts->tv_nsec); - - ts->tv_sec = t_s((long double)d.QuadPart/freq); - ts->tv_nsec = t_ns(part % 1000000000LL); + auto part = (long long)std::roundl((d.QuadPart * 1000000000.L) / freq); + ts->tv_sec = d.QuadPart/freq; + ts->tv_nsec = part % 1000000000; } #elif defined __MACH__ |