Merge pull request #2250 from esdrubal/master
[mono.git] / mono / io-layer / timefuncs.c
1 /*
2  * timefuncs.c:  performance timer and other time functions
3  *
4  * Author:
5  *      Dick Porter (dick@ximian.com)
6  *
7  * (C) 2002 Ximian, Inc.
8  */
9
10 #include <config.h>
11 #include <glib.h>
12 #include <sys/time.h>
13 #include <stdlib.h>
14 #include <stdio.h>
15
16 #include <mono/io-layer/wapi.h>
17 #include <mono/io-layer/timefuncs-private.h>
18 #include "mono/utils/mono-time.h"
19
20 #undef DEBUG
21
22 void _wapi_time_t_to_filetime (time_t timeval, WapiFileTime *filetime)
23 {
24         guint64 ticks;
25         
26         ticks = ((guint64)timeval * 10000000) + 116444736000000000ULL;
27         filetime->dwLowDateTime = ticks & 0xFFFFFFFF;
28         filetime->dwHighDateTime = ticks >> 32;
29 }
30
31 void _wapi_guint64_to_filetime (guint64 ticks, WapiFileTime *filetime)
32 {
33         filetime->dwLowDateTime = ticks & 0xFFFFFFFF;
34         filetime->dwHighDateTime = ticks >> 32;
35 }