aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_parse_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/ngx_http_parse_time.c')
-rw-r--r--src/http/ngx_http_parse_time.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/http/ngx_http_parse_time.c b/src/http/ngx_http_parse_time.c
index 09e56b4f0..26deb2841 100644
--- a/src/http/ngx_http_parse_time.c
+++ b/src/http/ngx_http_parse_time.c
@@ -232,16 +232,22 @@ time_t ngx_http_parse_time(char *value, size_t len)
return NGX_ERROR;
}
- /* shift new year to 1st March, needed for Gauss's formula */
+ /* shift new year to March 1, needed for Gauss's formula */
+
if (--month <= 0) {
month += 12;
year -= 1;
}
- /* Gauss's formula for Grigorian days from 1 March 1 BC */
+
+ /* Gauss's formula for Grigorian days from 1 March 1 BC */
+
return (365 * year + year / 4 - year / 100 + year / 400
+ 367 * month / 12 + day - 31
- /* 719527 days are between 1 March 1 BC and 1 March 1970,
- 31 and 28 days in Jan and Feb 1970 */
+ /*
+ * 719527 days are between March 1, 1 BC and March 1, 1970,
+ * 31 and 28 days in January and February 1970
+ */
+
- 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec;
}