2 * timefuncs.c: performance timer and other time functions
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
15 #include <mono/io-layer/wapi.h>
16 #include <mono/io-layer/timefuncs-private.h>
20 void _wapi_time_t_to_filetime (time_t timeval
, WapiFileTime
*filetime
)
24 ticks
= ((guint64
)timeval
* 10000000) + 116444736000000000ULL;
25 filetime
->dwLowDateTime
= ticks
& 0xFFFFFFFF;
26 filetime
->dwHighDateTime
= ticks
>> 32;
29 void _wapi_timeval_to_filetime (struct timeval
*tv
, WapiFileTime
*filetime
)
33 ticks
= ((guint64
)tv
->tv_sec
* 10000000) +
34 ((guint64
)tv
->tv_usec
* 10) + 116444736000000000ULL;
35 filetime
->dwLowDateTime
= ticks
& 0xFFFFFFFF;
36 filetime
->dwHighDateTime
= ticks
>> 32;
39 gboolean
QueryPerformanceCounter(WapiLargeInteger
*count G_GNUC_UNUSED
)
44 gboolean
QueryPerformanceFrequency(WapiLargeInteger
*freq G_GNUC_UNUSED
)
49 guint32
GetTickCount (void)
54 ret
=gettimeofday (&tv
, NULL
);
59 /* This is supposed to return milliseconds since reboot but I
60 * really can't be bothered to work out the uptime, especially
61 * as the 32bit value wraps around every 47 days
63 ret
=(guint32
)((tv
.tv_sec
* 1000) + (tv
.tv_usec
/ 1000));
66 g_message (G_GNUC_PRETTY_FUNCTION
": returning %d", ret
);