]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
There are only 24 hours in a day, not 60.
authorMiod Vallat <miod.vallat@powerdns.com>
Thu, 5 Feb 2026 08:19:53 +0000 (09:19 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 5 Feb 2026 08:19:53 +0000 (09:19 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/unix_utility.cc

index c58bf404221cd97cf42289459ff9bddbe38f5874..bca797ffd1c4c49edb61d4f84b06fd6620e4b716 100644 (file)
@@ -239,9 +239,10 @@ time_t Utility::timegm(struct tm *const t)
   time_t  i;
   time_t years = t->tm_year - 70;
 
+  // We allow for some benign out-of-range values
   if (t->tm_sec>60) { t->tm_min += t->tm_sec/60; t->tm_sec%=60; }
   if (t->tm_min>60) { t->tm_hour += t->tm_min/60; t->tm_min%=60; }
-  if (t->tm_hour>60) { t->tm_mday += t->tm_hour/60; t->tm_hour%=60; }
+  if (t->tm_hour>24) { t->tm_mday += t->tm_hour/24; t->tm_hour%=24; }
   if (t->tm_mon>11) { t->tm_year += t->tm_mon/12; t->tm_mon%=12; }
 
   while (t->tm_mday>spm[1+t->tm_mon]) {