aboutsummaryrefslogtreecommitdiffstats
path: root/src/system/Clock.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-29 22:55:18 +0100
committerMax Kellermann <max@duempel.org>2015-01-29 22:55:18 +0100
commit557bee61d57287827fb972e859ee454ac920a2a9 (patch)
tree7cf39a248df95bacb28c810f58913a664f30ee7b /src/system/Clock.cxx
parent8bfb88840b6ca28a7d3c155099aee905de529300 (diff)
parent3adca3c2fa21c4062aff62872b8f7f71d7cffe3e (diff)
downloadmpd-557bee61d57287827fb972e859ee454ac920a2a9.tar.gz
mpd-557bee61d57287827fb972e859ee454ac920a2a9.tar.xz
mpd-557bee61d57287827fb972e859ee454ac920a2a9.zip
Merge branch 'v0.19.x'
Diffstat (limited to '')
-rw-r--r--src/system/Clock.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/system/Clock.cxx b/src/system/Clock.cxx
index 38b24420d..161525fe1 100644
--- a/src/system/Clock.cxx
+++ b/src/system/Clock.cxx
@@ -40,8 +40,8 @@ MonotonicClockS(void)
if (base.denom == 0)
(void)mach_timebase_info(&base);
- return (unsigned)((mach_absolute_time() * base.numer / 1000)
- / (1000000 * base.denom));
+ return (unsigned)(((double)mach_absolute_time() * base.numer / 1000)
+ / base.denom / 1000000);
#elif defined(CLOCK_MONOTONIC)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -62,8 +62,8 @@ MonotonicClockMS(void)
if (base.denom == 0)
(void)mach_timebase_info(&base);
- return (unsigned)((mach_absolute_time() * base.numer)
- / (1000000 * base.denom));
+ return (unsigned)(((double)mach_absolute_time() * base.numer)
+ / base.denom / 1000000);
#elif defined(CLOCK_MONOTONIC)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -104,8 +104,8 @@ MonotonicClockUS(void)
if (base.denom == 0)
(void)mach_timebase_info(&base);
- return ((uint64_t)mach_absolute_time() * (uint64_t)base.numer)
- / (1000 * (uint64_t)base.denom);
+ return (uint64_t)(((double)mach_absolute_time() * base.numer)
+ / base.denom / 1000);
#elif defined(CLOCK_MONOTONIC)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);