Mercurial > hg > nginx
annotate src/http/ngx_http_parse_time.c @ 3672:4f021d4ceb88
fix building by owc12: GetLongPathName() is available since Win2K only
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 05 Jul 2010 12:47:35 +0000 |
parents | 8cec9724fe71 |
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:
290
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:
290
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:
290
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:
290
diff
changeset
|
5 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
7 #include <ngx_config.h> |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
8 #include <ngx_core.h> |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
10 |
3207
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
11 static ngx_uint_t mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
1628 | 13 time_t |
14 ngx_http_parse_time(u_char *value, size_t len) | |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
15 { |
3207
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
16 u_char *p, *end; |
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
17 ngx_int_t month; |
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
18 ngx_uint_t day, year, hour, min, sec; |
3208
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
19 uint64_t time; |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
20 enum { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
21 no = 0, |
684 | 22 rfc822, /* Tue, 10 Nov 2002 23:50:13 */ |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
23 rfc850, /* Tuesday, 10-Dec-02 23:50:13 */ |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
24 isoc /* Tue Dec 10 23:50:13 2002 */ |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
25 } fmt; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
26 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
27 fmt = 0; |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
28 end = value + len; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
30 #if (NGX_SUPPRESS_WARN) |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
31 day = 32; |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
32 year = 2038; |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
33 #endif |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
34 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
35 for (p = value; p < end; p++) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
36 if (*p == ',') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
37 break; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
38 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
40 if (*p == ' ') { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
41 fmt = isoc; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
42 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
43 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
44 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
46 for (p++; p < end; p++) |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
47 if (*p != ' ') { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 break; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
49 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
51 if (end - p < 18) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
52 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
53 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
54 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
55 if (fmt != isoc) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
56 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
57 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
58 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
59 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
60 day = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
61 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
62 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
63 if (*p == ' ') { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
64 if (end - p < 18) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
65 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
66 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
67 fmt = rfc822; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
68 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
69 } else if (*p == '-') { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
70 fmt = rfc850; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
71 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
72 } else { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
73 return NGX_ERROR; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
74 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
75 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
76 p++; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
77 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
78 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
79 switch (*p) { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
80 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
81 case 'J': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
82 month = *(p + 1) == 'a' ? 0 : *(p + 2) == 'n' ? 5 : 6; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
83 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
84 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
85 case 'F': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
86 month = 1; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
87 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
88 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
89 case 'M': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
90 month = *(p + 2) == 'r' ? 2 : 4; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
91 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
92 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
93 case 'A': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
94 month = *(p + 1) == 'p' ? 3 : 7; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
95 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
96 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
97 case 'S': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
98 month = 8; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
99 break; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
101 case 'O': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
102 month = 9; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
103 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
104 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
105 case 'N': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
106 month = 10; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
107 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
108 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
109 case 'D': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
110 month = 11; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
111 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
112 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
113 default: |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
114 return NGX_ERROR; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
115 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
116 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
117 p += 3; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
118 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
119 if ((fmt == rfc822 && *p != ' ') || (fmt == rfc850 && *p != '-')) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
120 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
121 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
122 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
123 p++; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
124 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
125 if (fmt == rfc822) { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
126 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
127 || *(p + 2) < '0' || *(p + 2) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
128 || *(p + 3) < '0' || *(p + 3) > '9') |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
129 { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
130 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
131 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
132 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
133 year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
134 + (*(p + 2) - '0') * 10 + *(p + 3) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
135 p += 4; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
136 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
137 } else if (fmt == rfc850) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
138 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
139 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
140 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
141 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
142 year = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
143 year += (year < 70) ? 2000 : 1900; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
144 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
145 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
146 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
147 if (fmt == isoc) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
148 if (*p == ' ') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
149 p++; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
150 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
151 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
152 if (*p < '0' || *p > '9') { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
153 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
154 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
155 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
156 day = *p++ - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
157 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
158 if (*p != ' ') { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
159 if (*p < '0' || *p > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
160 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
161 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
162 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
163 day = day * 10 + *p++ - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
164 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
165 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
166 if (end - p < 14) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
167 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
168 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
169 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
170 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
171 if (*p++ != ' ') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
172 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
173 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
174 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
175 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
176 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
177 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
178 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
179 hour = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
180 p += 2; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
181 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
182 if (*p++ != ':') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
183 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
184 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
185 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
186 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
187 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
188 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
189 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
190 min = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
191 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
192 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
193 if (*p++ != ':') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
194 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
195 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
196 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
197 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
198 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
199 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
200 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
201 sec = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
202 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
203 if (fmt == isoc) { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
204 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
205 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
206 if (*p++ != ' ') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
207 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
208 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
209 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
210 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
211 || *(p + 2) < '0' || *(p + 2) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
212 || *(p + 3) < '0' || *(p + 3) > '9') |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
213 { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
214 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
215 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
216 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
217 year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
218 + (*(p + 2) - '0') * 10 + *(p + 3) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
219 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
220 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
221 if (hour > 23 || min > 59 || sec > 59) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
222 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
223 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
224 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
225 if (day == 29 && month == 1) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
226 if ((year & 3) || ((year % 100 == 0) && (year % 400) != 0)) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
227 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
228 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
229 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
230 } else if (day > mday[month]) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
231 return NGX_ERROR; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
232 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
233 |
181
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
234 /* |
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
235 * shift new year to March 1 and start months from 1 (not 0), |
1964 | 236 * it is needed for Gauss' formula |
181
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
237 */ |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
238 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
239 if (--month <= 0) { |
1062 | 240 month += 12; |
241 year -= 1; | |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
242 } |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
243 |
1964 | 244 /* Gauss' formula for Grigorian days since March 1, 1 BC */ |
245 | |
3208
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
246 time = (uint64_t) ( |
1964 | 247 /* days in years including leap years since March 1, 1 BC */ |
248 | |
249 365 * year + year / 4 - year / 100 + year / 400 | |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
250 |
1964 | 251 /* days before the month */ |
252 | |
253 + 367 * month / 12 - 30 | |
254 | |
255 /* days before the day */ | |
256 | |
257 + day - 1 | |
181
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
258 |
479 | 259 /* |
260 * 719527 days were between March 1, 1 BC and March 1, 1970, | |
1062 | 261 * 31 and 28 days were in January and February 1970 |
479 | 262 */ |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
263 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
264 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec; |
3208
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
265 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
266 #if (NGX_TIME_T_SIZE <= 4) |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
267 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
268 if (time > 0x7fffffff) { |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
269 return NGX_ERROR; |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
270 } |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
271 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
272 #endif |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
273 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
274 return (time_t) time; |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
275 } |