comparison src/http/ngx_http_parse_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 a499e0d1f16e
children 811bdd2af794
comparison
equal deleted inserted replaced
178:a8ff48d26cca 179:9f3a78b06c48
230 230
231 if (sizeof(time_t) <= 4 && year >= 2038) { 231 if (sizeof(time_t) <= 4 && year >= 2038) {
232 return NGX_ERROR; 232 return NGX_ERROR;
233 } 233 }
234 234
235 /* shift new year to 1st March, needed for Gauss's formula */ 235 /* shift new year to March 1, needed for Gauss's formula */
236
236 if (--month <= 0) { 237 if (--month <= 0) {
237 month += 12; 238 month += 12;
238 year -= 1; 239 year -= 1;
239 } 240 }
240 /* Gauss's formula for Grigorian days from 1 March 1 BC */ 241
242 /* Gauss's formula for Grigorian days from 1 March 1 BC */
243
241 return (365 * year + year / 4 - year / 100 + year / 400 244 return (365 * year + year / 4 - year / 100 + year / 400
242 + 367 * month / 12 + day - 31 245 + 367 * month / 12 + day - 31
243 /* 719527 days are between 1 March 1 BC and 1 March 1970, 246 /*
244 31 and 28 days in Jan and Feb 1970 */ 247 * 719527 days are between March 1, 1 BC and March 1, 1970,
248 * 31 and 28 days in January and February 1970
249 */
250
245 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec; 251 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec;
246 } 252 }
247 253
248 #if 0 254 #if 0
249 char zero[] = "Sun, 01 Jan 1970 08:49:30"; 255 char zero[] = "Sun, 01 Jan 1970 08:49:30";