Mercurial > hg > nginx-quic
comparison src/http/ngx_http_parse_time.c @ 181:811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 12 Nov 2003 17:25:12 +0000 |
parents | 9f3a78b06c48 |
children | 87e73f067470 |
comparison
equal
deleted
inserted
replaced
180:2d143372a1ee | 181:811bdd2af794 |
---|---|
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 March 1, needed for Gauss's formula */ | 235 /* |
236 * shift new year to March 1 and start months from 1 (not 0), | |
237 * it's needed for Gauss's formula | |
238 */ | |
236 | 239 |
237 if (--month <= 0) { | 240 if (--month <= 0) { |
238 month += 12; | 241 month += 12; |
239 year -= 1; | 242 year -= 1; |
240 } | 243 } |
241 | 244 |
242 /* Gauss's formula for Grigorian days from 1 March 1 BC */ | 245 /* Gauss's formula for Grigorian days from 1 March 1 BC */ |
243 | 246 |
244 return (365 * year + year / 4 - year / 100 + year / 400 | 247 return (365 * year + year / 4 - year / 100 + year / 400 |
245 + 367 * month / 12 + day - 31 | 248 + 367 * month / 12 - 31 |
249 + day | |
250 | |
246 /* | 251 /* |
247 * 719527 days are between March 1, 1 BC and March 1, 1970, | 252 * 719527 days were between March 1, 1 BC and March 1, 1970, |
248 * 31 and 28 days in January and February 1970 | 253 * 31 and 28 days in January and February 1970 |
249 */ | 254 */ |
250 | 255 |
251 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec; | 256 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec; |
252 } | 257 } |