Mercurial > hg > nginx
comparison src/os/win32/ngx_time.c @ 179:9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 11 Nov 2003 18:13:43 +0000 |
parents | |
children | 2d143372a1ee |
comparison
equal
deleted
inserted
replaced
178:a8ff48d26cca | 179:9f3a78b06c48 |
---|---|
1 | |
2 #include <ngx_config.h> | |
3 #include <ngx_core.h> | |
4 | |
5 | |
6 void ngx_gettimeofday(struct timeval *tp) | |
7 { | |
8 uint64_t intervals; | |
9 FILETIME ft; | |
10 | |
11 GetSystemTimeAsFileTime(&ft); | |
12 | |
13 /* | |
14 * A file time is a 64-bit value that represents the number | |
15 * of 100-nanosecond intervals that have elapsed since | |
16 * 12:00 A.M. January 1, 1601 (UTC). | |
17 * | |
18 * Between January 1, 1970 (Epoch) and January 1, 1601 there are | |
19 * 134744 days, | |
20 * 11644473600 seconds or | |
21 * 11644473600,000,000,0 100-nanosecond intervals. | |
22 */ | |
23 | |
24 intervals = ((uint64_t) ft.dwHighDateTime << 32) | ft.dwLowDateTime; | |
25 intervals -= 116444736000000000; | |
26 | |
27 tp->tv_sec = intervals / 10000000; | |
28 tp->tv_usec = (intervals % 10000000) / 10; | |
29 } |