Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4680 | right-hear | 1 | #ifdef _WIN32 |
2 | |||
3 | #include |
||
4 | #include |
||
5 | #include |
||
6 | |||
7 | #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) |
||
8 | #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 |
||
9 | #else |
||
10 | #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL |
||
11 | #endif |
||
12 | |||
13 | struct timeval; |
||
14 | |||
15 | int gettimeofday(struct timeval *tv, struct timezone *tz) |
||
16 | { |
||
17 | FILETIME ft; |
||
18 | unsigned __int64 tmpres = 0; |
||
19 | |||
20 | if (tv) |
||
21 | { |
||
22 | GetSystemTimeAsFileTime(&ft); |
||
23 | |||
24 | tmpres |= ft.dwHighDateTime; |
||
25 | tmpres <<= 32; |
||
26 | tmpres |= ft.dwLowDateTime; |
||
27 | |||
28 | tmpres /= 10; /*convert into microseconds*/ |
||
29 | /*converting file time to unix epoch*/ |
||
30 | tmpres -= DELTA_EPOCH_IN_MICROSECS; |
||
31 | tv->tv_sec = (long)(tmpres / 1000000UL); |
||
32 | tv->tv_usec = (long)(tmpres % 1000000UL); |
||
33 | } |
||
34 | |||
35 | return 0; |
||
36 | } |
||
37 | |||
38 | #else |
||
39 | |||
40 | void fz_gettimeofday_dummy() { } |
||
41 | |||
42 | #endif=><=> |