Correct the gettime calculations once more. (#395203, Chris Wilson)
authorMatthias Clasen <mclasen@redhat.com>
Mon, 15 Jan 2007 03:34:42 +0000 (03:34 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 15 Jan 2007 03:34:42 +0000 (03:34 +0000)
2005-01-15  Matthias Clasen  <mclasen@redhat.com>

        * glib/gthread.c:
        * gthread/gthread-posix.c: Correct the gettime calculations
        once more.  (#395203, Chris Wilson)

svn path=/trunk/; revision=5262

ChangeLog
glib/gthread.c
gthread/gthread-posix.c

index 4871859de68958915817a0822ae7f3adef59d8fa..b69daa63ef86767f8f9467bc5f5f2f5fa02597ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-01-15  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gthread.c:
+       * gthread/gthread-posix.c: Correct the gettime calculations
+       once more.  (#395203, Chris Wilson)
+
 2007-01-15  Tor Lillqvist  <tml@novell.com>
 
        * glib/gmain.h (struct _GPollFD): Prepare for potential Win64
index 17d737cc8a13e337c9a1f571a6d4dc8412dc973c..ad1b77fbd99bcc7d5e93655bf286d4d8a97fbc5e 100644 (file)
@@ -546,6 +546,8 @@ g_thread_fail (void)
   g_error ("The thread system is not yet initialized.");
 }
 
+#define G_NSEC_PER_SEC 1000000000
+
 static guint64
 gettime (void)
 {
@@ -560,7 +562,7 @@ gettime (void)
 
   gettimeofday (&tv, NULL);
 
-  return (guint64) tv.tv_sec * 1000000000 + tv.tv_usec * 1000
+  return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_usec * (G_NSEC_PER_SEC / G_USEC_PER_SEC)
 #endif
 }
 
index 124d452e12edb6e91c1df4ac05ee74a846e512c7..711fcd3a733351851cd5a919af57c9e2df3429f5 100644 (file)
@@ -429,7 +429,6 @@ g_thread_equal_posix_impl (gpointer thread1, gpointer thread2)
 static guint64
 g_gettime_posix_impl (void)
 {
-#define G_NSEC_PER_SEC 100000000000
 #ifdef USE_CLOCK_GETTIME 
   struct timespec tv;
 
@@ -441,7 +440,7 @@ g_gettime_posix_impl (void)
 
   gettimeofday (&tv, NULL);
 
-  return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_usec * 1000; 
+  return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_usec * (G_NSEC_PER_SEC / G_USEC_PER_SEC);
 #endif
 }