commit d3f6fa971de7cee49a877f2ea8d8049cc726273d
parent 0b4fa1949cf1763cf901c63caf7062df66bc5a07
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 30 Apr 2019 09:30:37 +0100
[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.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libc/time/mktime.c b/src/libc/time/mktime.c
@@ -50,7 +50,7 @@ normalize(struct tm *tm)
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 @@ normalize(struct tm *tm)
day -= _daysmon[mon];
if (mon == DEC) {
if (year == _MAXYEAR)
- return -1;
+ return 0;
year++;
_daysmon[FEB] = FEBDAYS(year);
mon = JAN-1;