diff options
author | Matthias Clasen <mclasen@redhat.com> | 2007-01-12 05:55:16 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2007-01-12 05:55:16 +0000 |
commit | 2c7dbe9c73c94ce2ffab2166a6fa5207c446ff2b (patch) | |
tree | 07774472b08d79b29aac2c902697a6fed850bc17 | |
parent | a0c1c3b14ebe25e99673bd3888dc9592ab85e434 (diff) |
Fix errors in the recently moved time calculations. (#395203, Chris
2007-01-12 Matthias Clasen <mclasen@redhat.com>
* gthread/gthread-posix.c:
* glib/gtimer.c:
* glib/gthread.c: Fix errors in the recently moved
time calculations. (#395203, Chris Wilson)
svn path=/trunk/; revision=5244
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | glib/gthread.c | 2 | ||||
-rw-r--r-- | glib/gtimer.c | 4 | ||||
-rw-r--r-- | gthread/gthread-posix.c | 5 |
4 files changed, 13 insertions, 5 deletions
@@ -1,3 +1,10 @@ +2007-01-12 Matthias Clasen <mclasen@redhat.com> + + * gthread/gthread-posix.c: + * glib/gtimer.c: + * glib/gthread.c: Fix errors in the recently moved + time calculations. (#395203, Chris Wilson) + 2007-01-10 Matthias Clasen <mclasen@redhat.com> * configure.in: Actually link gthread against librt. diff --git a/glib/gthread.c b/glib/gthread.c index a2fa8b94c..de8855fdc 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -557,7 +557,7 @@ gettime (void) gettimeofday (&tv, NULL); - return tv.tv_sec * 1e9 + tv.tv_usec * 1000; + return (guint64) tv.tv_sec * 1000000000 + tv.tv_usec * 1000; #endif } diff --git a/glib/gtimer.c b/glib/gtimer.c index bedaf47ad..be1dc26f1 100644 --- a/glib/gtimer.c +++ b/glib/gtimer.c @@ -149,10 +149,10 @@ g_timer_elapsed (GTimer *timer, elapsed = timer->end - timer->start; - total = elapsed / 1e7; + total = elapsed / 1e9; if (microseconds) - *microseconds = (elapsed / 10) % 1000000; + *microseconds = (elapsed / 1000) % 1000000; return total; } diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c index d05165c68..124d452e1 100644 --- a/gthread/gthread-posix.c +++ b/gthread/gthread-posix.c @@ -429,18 +429,19 @@ 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; clock_gettime (posix_clock, &tv); - return tv.tv_sec * 1e9 + tv.tv_nsec; + return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_nsec; #else struct timeval tv; gettimeofday (&tv, NULL); - return tv.tv_sec * 1e9 + tv.tv_usec * 1000; + return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_usec * 1000; #endif } |