Fix off-by-1000 for GTimer
authorOwen W. Taylor <otaylor@fishsoup.net>
Mon, 22 Nov 2010 02:59:57 +0000 (21:59 -0500)
committerOwen W. Taylor <otaylor@fishsoup.net>
Mon, 22 Nov 2010 03:01:52 +0000 (22:01 -0500)
Divide monotonic time by 1e6 not 1e9 to get seconds.

glib/gtimer.c

index 04f830c..0395fb0 100644 (file)
@@ -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;
 }