mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 10:07:13 +02:00
Correct the gettime calculations once more. (#395203, Chris Wilson)
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
This commit is contained in:
committed by
Matthias Clasen
parent
b7899ae84a
commit
73a581c8ba
@@ -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>
|
2007-01-15 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* glib/gwin32.c (g_win32_getlocale): Simplify greatly. Instead of
|
* glib/gwin32.c (g_win32_getlocale): Simplify greatly. Instead of
|
||||||
|
@@ -546,6 +546,8 @@ g_thread_fail (void)
|
|||||||
g_error ("The thread system is not yet initialized.");
|
g_error ("The thread system is not yet initialized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define G_NSEC_PER_SEC 1000000000
|
||||||
|
|
||||||
static guint64
|
static guint64
|
||||||
gettime (void)
|
gettime (void)
|
||||||
{
|
{
|
||||||
@@ -560,7 +562,7 @@ gettime (void)
|
|||||||
|
|
||||||
gettimeofday (&tv, NULL);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -429,7 +429,6 @@ g_thread_equal_posix_impl (gpointer thread1, gpointer thread2)
|
|||||||
static guint64
|
static guint64
|
||||||
g_gettime_posix_impl (void)
|
g_gettime_posix_impl (void)
|
||||||
{
|
{
|
||||||
#define G_NSEC_PER_SEC 100000000000
|
|
||||||
#ifdef USE_CLOCK_GETTIME
|
#ifdef USE_CLOCK_GETTIME
|
||||||
struct timespec tv;
|
struct timespec tv;
|
||||||
|
|
||||||
@@ -441,7 +440,7 @@ g_gettime_posix_impl (void)
|
|||||||
|
|
||||||
gettimeofday (&tv, NULL);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user