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
+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.
gettimeofday (&tv, NULL);
- return tv.tv_sec * 1e9 + tv.tv_usec * 1000;
+ return (guint64) tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
#endif
}
elapsed = timer->end - timer->start;
- total = elapsed / 1e7;
+ total = elapsed / 1e9;
if (microseconds)
- *microseconds = (elapsed / 10) % 1000000;
+ *microseconds = (elapsed / 1000) % 1000000;
return total;
}
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
}