aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/ngx_times.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index ef63f1e3d..b2edf1a5f 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -311,6 +311,16 @@ ngx_gmtime(time_t t, ngx_tm_t *tp)
days = t / 86400;
sec = t % 86400;
+ /*
+ * no more than 4 year digits supported,
+ * truncate to December 31, 9999, 23:59:59
+ */
+
+ if (days > 2932896) {
+ days = 2932896;
+ sec = 86399;
+ }
+
/* January 1, 1970 was Thursday */
wday = (4 + days) % 7;