shithub: scc

Download patch

ref: 2e11e73feafef4fd29df8e3a46e767da3b9a1877
parent: 8598e0bb82f2722b96e7afa37922ba5107062692
author: Naveen Narayanan <[email protected]>
date: Fri Aug 28 07:15:53 EDT 2020

libc: Fix bug in normalize (mktime)

--- a/src/libc/time/mktime.c
+++ b/src/libc/time/mktime.c
@@ -43,7 +43,7 @@
 	}
 
 	day = tm->tm_mday;
-	year = EPOCH + tm->tm_year;
+	year = 1900 + tm->tm_year;
 	_daysmon[FEB] = FEBDAYS(year);
 
 	for (mon = tm->tm_mon; day < 1; --mon) {
@@ -69,7 +69,7 @@
 	}
 
 	tm->tm_mon = mon;
-	tm->tm_year = year - EPOCH;
+	tm->tm_year = year - 1900;
 	tm->tm_mday = day;
 	tm->tm_wday = (_newyear(tm->tm_year) + tm->tm_yday) % 7;