From 29856165329597e47d0a45d03c76974a8543139b Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 21 Jun 2018 22:42:26 +0200 Subject: [PATCH] Fix the Mac OS X timer implementation The Mac OS X timer implementation returned timestamps with nanoseconds as unit instead of microseconds. Reported-by: Rick Balsano --- src/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timer.c b/src/timer.c index 36d1f8f..14ccd46 100644 --- a/src/timer.c +++ b/src/timer.c @@ -132,7 +132,7 @@ dc_timer_now (dc_timer_t *timer, dc_usecs_t *usecs) value = (dc_usecs_t) delta.tv_sec * 1000000 + delta.tv_nsec / 1000; #elif defined (HAVE_MACH_ABSOLUTE_TIME) uint64_t now = mach_absolute_time(); - value = (now - timer->timestamp) * timer->info.numer / timer->info.denom; + value = (now - timer->timestamp) * timer->info.numer / (timer->info.denom * 1000); #else struct timeval now, delta; if (gettimeofday (&now, NULL) != 0) {