mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-25 21:46:14 +01:00
Simplify, use GetSystemTimeAsFileTime().
2000-08-31 Tor Lillqvist <tml@iki.fi> * gmain.c (g_get_current_time): (Win32): Simplify, use GetSystemTimeAsFileTime().
This commit is contained in:
parent
55cd16c993
commit
a7e60b7576
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* gmain.c (g_get_current_time): (Win32): Simplify, use
|
||||||
|
GetSystemTimeAsFileTime().
|
||||||
|
|
||||||
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
2000-08-27 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
* giowin32.c (g_io_channel_win32_poll): New function, otherwise
|
||||||
|
25
glib/gmain.c
25
glib/gmain.c
@ -629,26 +629,15 @@ g_get_current_time (GTimeVal *result)
|
|||||||
result->tv_sec = r.tv_sec;
|
result->tv_sec = r.tv_sec;
|
||||||
result->tv_usec = r.tv_usec;
|
result->tv_usec = r.tv_usec;
|
||||||
#else
|
#else
|
||||||
/* Avoid calling time() except for the first time.
|
FILETIME filetime;
|
||||||
* GetTickCount() should be pretty fast and low-level?
|
gint64 t;
|
||||||
* I could also use ftime() but it seems unnecessarily overheady.
|
|
||||||
*/
|
|
||||||
static DWORD start_tick = 0;
|
|
||||||
static time_t start_time;
|
|
||||||
DWORD tick;
|
|
||||||
|
|
||||||
g_return_if_fail (result != NULL);
|
GetSystemTimeAsFileTime (&filetime);
|
||||||
|
t = ((gint64) filetime.dwLowDateTime) +
|
||||||
|
((gint64) filetime.dwHighDateTime) * G_GINT64_CONSTANT (0x100000000);
|
||||||
|
|
||||||
if (start_tick == 0)
|
result->tv_sec = (t - G_GINT64_CONSTANT (0x19db1ded53e8000)) / 10000000;
|
||||||
{
|
result->tv_usec = (t % 10000000) / 10;
|
||||||
start_tick = GetTickCount ();
|
|
||||||
time (&start_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
tick = GetTickCount ();
|
|
||||||
|
|
||||||
result->tv_sec = (tick - start_tick) / 1000 + start_time;
|
|
||||||
result->tv_usec = ((tick - start_tick) % 1000) * 1000;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
gmain.c
25
gmain.c
@ -629,26 +629,15 @@ g_get_current_time (GTimeVal *result)
|
|||||||
result->tv_sec = r.tv_sec;
|
result->tv_sec = r.tv_sec;
|
||||||
result->tv_usec = r.tv_usec;
|
result->tv_usec = r.tv_usec;
|
||||||
#else
|
#else
|
||||||
/* Avoid calling time() except for the first time.
|
FILETIME filetime;
|
||||||
* GetTickCount() should be pretty fast and low-level?
|
gint64 t;
|
||||||
* I could also use ftime() but it seems unnecessarily overheady.
|
|
||||||
*/
|
|
||||||
static DWORD start_tick = 0;
|
|
||||||
static time_t start_time;
|
|
||||||
DWORD tick;
|
|
||||||
|
|
||||||
g_return_if_fail (result != NULL);
|
GetSystemTimeAsFileTime (&filetime);
|
||||||
|
t = ((gint64) filetime.dwLowDateTime) +
|
||||||
|
((gint64) filetime.dwHighDateTime) * G_GINT64_CONSTANT (0x100000000);
|
||||||
|
|
||||||
if (start_tick == 0)
|
result->tv_sec = (t - G_GINT64_CONSTANT (0x19db1ded53e8000)) / 10000000;
|
||||||
{
|
result->tv_usec = (t % 10000000) / 10;
|
||||||
start_tick = GetTickCount ();
|
|
||||||
time (&start_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
tick = GetTickCount ();
|
|
||||||
|
|
||||||
result->tv_sec = (tick - start_tick) / 1000 + start_time;
|
|
||||||
result->tv_usec = ((tick - start_tick) % 1000) * 1000;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user