mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 18:16:34 +02:00
glib/gthread.c (gettime) GetSystemTimeAsFileTime() returns 100s of
2007-01-16 Tor Lillqvist <tml@novell.com> * glib/gthread.c (gettime) * gthread/gthread-win32.c (g_gettime_win32_impl): GetSystemTimeAsFileTime() returns 100s of nanoseconds since 1601, so offset to Unix epoch (1970) and multiply by 100 to get nanoseconds which is what we want. svn path=/branches/glib-2-12/; revision=5278
This commit is contained in:
committed by
Tor Lillqvist
parent
e65bdcd6db
commit
4c49bbeec1
@@ -1,8 +1,8 @@
|
|||||||
2007-01-16 Tor Lillqvist <tml@novell.com>
|
2007-01-16 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* glib/gthread.c (gettime): GetSystemTimeAsFileTime() returns 100s
|
* glib/gthread.c (gettime): GetSystemTimeAsFileTime() returns 100s
|
||||||
of nanoseconds, so multiply by 100 to get nanoseconds which is
|
of nanoseconds since 1601, so offset to Unix epoch (1970) and
|
||||||
what we want.
|
multiply by 100 to get nanoseconds which is what we want.
|
||||||
|
|
||||||
2005-01-15 Matthias Clasen <mclasen@redhat.com>
|
2005-01-15 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
@@ -554,7 +554,12 @@ gettime (void)
|
|||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
guint64 v;
|
guint64 v;
|
||||||
|
|
||||||
|
/* Returns 100s of nanoseconds since start of 1601 */
|
||||||
GetSystemTimeAsFileTime ((FILETIME *)&v);
|
GetSystemTimeAsFileTime ((FILETIME *)&v);
|
||||||
|
|
||||||
|
/* Offset to Unix epoch */
|
||||||
|
v -= G_GINT64_CONSTANT (116444736000000000);
|
||||||
|
/* Convert to nanoseconds */
|
||||||
v *= 100;
|
v *= 100;
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
2007-01-16 Tor Lillqvist <tml@novell.com>
|
2007-01-16 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* gthread-win32.c (g_gettime_win32_impl):
|
* gthread-win32.c (g_gettime_win32_impl):
|
||||||
GetSystemTimeAsFileTime() returns 100s of nanoseconds, so multiply
|
GetSystemTimeAsFileTime() returns 100s of nanoseconds since 1601,
|
||||||
by 100 to get nanoseconds which is what we want.
|
so offset to Unix epoch (1970) and multiply by 100 to get
|
||||||
|
nanoseconds which is what we want.
|
||||||
|
|
||||||
2005-01-15 Matthias Clasen <mclasen@redhat.com>
|
2005-01-15 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
@@ -550,7 +550,12 @@ g_gettime_win32_impl (void)
|
|||||||
{
|
{
|
||||||
guint64 v;
|
guint64 v;
|
||||||
|
|
||||||
|
/* Returns 100s of nanoseconds since start of 1601 */
|
||||||
GetSystemTimeAsFileTime ((FILETIME *)&v);
|
GetSystemTimeAsFileTime ((FILETIME *)&v);
|
||||||
|
|
||||||
|
/* Offset to Unix epoch */
|
||||||
|
v -= G_GINT64_CONSTANT (116444736000000000);
|
||||||
|
/* Convert to nanoseconds */
|
||||||
v *= 100;
|
v *= 100;
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
Reference in New Issue
Block a user