comparison src/http/ngx_http_parse_time.c @ 1723:9b047c9e96c1 stable-0.5

r1587, r1588, r1589, r1590, r1592, r1599, r1629, r1636, r1674, r1681, r1682, r1683 merge: typo and style fixes
author Igor Sysoev <igor@sysoev.ru>
date Wed, 12 Dec 2007 20:49:45 +0000
parents bc9751affada
children a3e84e78e785
comparison
equal deleted inserted replaced
1722:3b7262e720c1 1723:9b047c9e96c1
9 #include <ngx_types.h> 9 #include <ngx_types.h>
10 10
11 11
12 static int mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 12 static int mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
13 13
14 time_t ngx_http_parse_time(u_char *value, size_t len) 14 time_t
15 ngx_http_parse_time(u_char *value, size_t len)
15 { 16 {
16 u_char *p, *end; 17 u_char *p, *end;
17 int day, month, year, hour, min, sec; 18 int day, month, year, hour, min, sec;
18 enum { 19 enum {
19 no = 0, 20 no = 0,
245 if (--month <= 0) { 246 if (--month <= 0) {
246 month += 12; 247 month += 12;
247 year -= 1; 248 year -= 1;
248 } 249 }
249 250
250 /* Gauss's formula for Grigorian days from 1 March 1 BC */ 251 /* Gauss's formula for Grigorian days from March 1, 1 BC */
251 252
252 return (365 * year + year / 4 - year / 100 + year / 400 253 return (365 * year + year / 4 - year / 100 + year / 400
253 + 367 * month / 12 - 31 254 + 367 * month / 12 - 31
254 + day 255 + day
255 256