scc

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

commit 5f241cec09bb5c207955933e41ac692f2de2c44b
parent ff9adc87fdf01624d56144bc389479eabc4933cf
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Fri, 24 Apr 2026 23:57:06 +0200

libc/time; Fix handling of bisiest years

The previous commit was just wrong, because it denied any
dst zone only because the current time was February 29th.
The fix is just the other way around. Modify the start/end
dyear if we are in a bis year and after the February 28th.

Diffstat:
Msrc/libc/arch/posix/_tzone.c | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/libc/arch/posix/_tzone.c b/src/libc/arch/posix/_tzone.c @@ -273,22 +273,23 @@ error: int _isdst(struct tm *tm) { - int d, bis; + int d, bis, yday; if (!_daylight) return 0; bis = FEBDAYS(tm->tm_year) == 29; + yday = tm->tm_yday; - d = tm->tm_yday; - if (sjulian && d > 59 && bis) + d = start; + if (sjulian && bis && d >= 59) d++; - if (d < start || tm->tm_hour <= 2) + if (yday < d || tm->tm_hour <= 2) return 0; - d = tm->tm_yday; - if (ejulian && d > 59 && bis) + d = end; + if (ejulian && bis && d >= 59) d++; - if (d > end || tm->tm_hour <= 2) + if (yday > d || tm->tm_hour <= 2) return 0; return 1;