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
This commit is contained in:
Matthias Clasen
2007-01-12 05:55:16 +00:00
committed by Matthias Clasen
parent a0c1c3b14e
commit 2c7dbe9c73
4 changed files with 13 additions and 5 deletions

View File

@@ -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
}