scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 86b5e746d19539add2df370455006cfc4c679648
parent c4abae030242ab0d8ca7e13fd4d6fcb2440b544b
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:
Msrc/libc/time/mktime.c | 4++--
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;