shithub: scc

Download patch

ref: 86b5e746d19539add2df370455006cfc4c679648
parent: c4abae030242ab0d8ca7e13fd4d6fcb2440b544b
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Apr 30 05:30:37 EDT 2019

[libc] Return valid error code in normalize()

Return 0 that is the error indication in normalize()
when the date cannot be represented in the supported
interval.

--- a/src/libc/time/mktime.c
+++ b/src/libc/time/mktime.c
@@ -50,7 +50,7 @@
 		day += _daysmon[mon];
 		if (mon == JAN) {
 			if (year == EPOCH)
-				return -1;
+				return 0;
 			year--;
 			_daysmon[FEB] = FEBDAYS(year);
 			mon = DEC+1;
@@ -61,7 +61,7 @@
 		day -= _daysmon[mon];
 		if (mon == DEC) {
 			if (year == _MAXYEAR)
-				return -1;
+				return 0;
 			year++;
 			_daysmon[FEB] = FEBDAYS(year);
 			mon = JAN-1;