summaryrefslogtreecommitdiff
path: root/gthread
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2007-01-12 05:50:45 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-01-12 05:50:45 +0000
commit8055038c9cba935cdacd734f7524c5fb45a52e98 (patch)
tree688ab18263389b7ac953ca7a55565773463f7908 /gthread
parente6558084803539f155ea9387e454977d7487bcdf (diff)
fix timer calculations
svn path=/branches/glib-2-12/; revision=5243
Diffstat (limited to 'gthread')
-rw-r--r--gthread/gthread-posix.c5
1 files changed, 3 insertions, 2 deletions
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
}