Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Correct the gettime calculations once more. (#395203, Chris Wilson)
Browse files Browse the repository at this point in the history
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=/branches/glib-2-12/; revision=5263
  • Loading branch information
Matthias Clasen authored and Matthias Clasen committed Jan 15, 2007
1 parent b7899ae commit 73a581c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
@@ -1,3 +1,11 @@
2005-01-15 Matthias Clasen <mclasen@redhat.com>

Merge from trunk:

* 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/gwin32.c (g_win32_getlocale): Simplify greatly. Instead of
Expand Down
4 changes: 3 additions & 1 deletion glib/gthread.c
Expand Up @@ -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)
{
Expand All @@ -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
}

Expand Down
3 changes: 1 addition & 2 deletions gthread/gthread-posix.c
Expand Up @@ -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;

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

Expand Down

0 comments on commit 73a581c

Please sign in to comment.