From a70ba9c8b15451a8722aebfb64232bd18abf0a79 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sun, 21 Nov 2010 21:59:57 -0500 Subject: [PATCH] Fix off-by-1000 for GTimer Divide monotonic time by 1e6 not 1e9 to get seconds. --- glib/gtimer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/gtimer.c b/glib/gtimer.c index 04f830c..0395fb0 100644 --- a/glib/gtimer.c +++ b/glib/gtimer.c @@ -233,10 +233,10 @@ g_timer_elapsed (GTimer *timer, elapsed = timer->end - timer->start; - total = elapsed / 1e9; + total = elapsed / 1e6; if (microseconds) - *microseconds = (elapsed / 1000) % 1000000; + *microseconds = elapsed % 1000000; return total; } -- 2.7.4