Mercurial > hg > nginx
annotate src/os/win32/ngx_time.c @ 4282:71cdac0b9ea6
Fix of "Content-Length" header of MP4 response if start argument was used.
Patch by Piotr Sikora.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 14 Nov 2011 14:42:48 +0000 |
parents | 9fd2f12fee0a |
children | d620f497c50f |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
5 |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
563 | 11 void |
12 ngx_gettimeofday(struct timeval *tp) | |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 { |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 uint64_t intervals; |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 FILETIME ft; |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 GetSystemTimeAsFileTime(&ft); |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
18 |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 /* |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 * A file time is a 64-bit value that represents the number |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 * of 100-nanosecond intervals that have elapsed since |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
22 * January 1, 1601 12:00 A.M. UTC. |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
23 * |
181
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
180
diff
changeset
|
24 * Between January 1, 1970 (Epoch) and January 1, 1601 there were |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 * 134744 days, |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
26 * 11644473600 seconds or |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
27 * 11644473600,000,000,0 100-nanosecond intervals. |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
181
diff
changeset
|
28 * |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
181
diff
changeset
|
29 * See also MSKB Q167296. |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 */ |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
32 intervals = ((uint64_t) ft.dwHighDateTime << 32) | ft.dwLowDateTime; |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 intervals -= 116444736000000000; |
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
180
2d143372a1ee
nginx-0.0.1-2003-11-12-01:16:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
35 tp->tv_sec = (long) (intervals / 10000000); |
2d143372a1ee
nginx-0.0.1-2003-11-12-01:16:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
36 tp->tv_usec = (long) ((intervals % 10000000) / 10); |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 } |
324
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
38 |
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
39 |
563 | 40 void |
41 ngx_libc_localtime(time_t s, struct tm *tm) | |
509 | 42 { |
43 struct tm *t; | |
44 | |
563 | 45 t = localtime(&s); |
509 | 46 *tm = *t; |
47 } | |
48 | |
49 | |
563 | 50 void |
51 ngx_libc_gmtime(time_t s, struct tm *tm) | |
509 | 52 { |
53 struct tm *t; | |
54 | |
563 | 55 t = gmtime(&s); |
509 | 56 *tm = *t; |
57 } | |
58 | |
59 | |
563 | 60 ngx_int_t |
61 ngx_gettimezone(void) | |
324
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
62 { |
2724 | 63 u_long n; |
324
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
64 TIME_ZONE_INFORMATION tz; |
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
65 |
2724 | 66 n = GetTimeZoneInformation(&tz); |
67 | |
68 switch (n) { | |
69 | |
70 case TIME_ZONE_ID_UNKNOWN: | |
324
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
71 return -tz.Bias; |
2724 | 72 |
73 case TIME_ZONE_ID_STANDARD: | |
74 return -(tz.Bias + tz.StandardBias); | |
75 | |
76 case TIME_ZONE_ID_DAYLIGHT: | |
77 return -(tz.Bias + tz.DaylightBias); | |
78 | |
79 default: /* TIME_ZONE_ID_INVALID */ | |
80 return 0; | |
324
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
81 } |
0ab66f4b6c4d
nginx-0.0.3-2004-04-22-00:13:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
82 } |