commit 8d5c42a0606b6ba6528c8fc4740fa75f4793051e
parent f717073ae1c23b90b63645014a35a9bf2bb4198a
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 21 Apr 2026 10:12:51 +0200
libc/time: Remove redundant _daylight checks
The _isdst() function has to consider _daylight, so checking it
in every call is redundant.
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libc/time/localtime.c b/src/libc/time/localtime.c
@@ -17,7 +17,7 @@ localtime(const time_t *timep)
tm = gmtime(&t);
_tzset();
- if (_daylight && _isdst(tm)) {
+ if (_isdst(tm)) {
dst = 1;
off = _dstzone;
name = _tzname[1];
diff --git a/src/libc/time/mktime.c b/src/libc/time/mktime.c
@@ -131,7 +131,7 @@ mktime(struct tm *ptm)
t += (tm.tm_mday-1) * SECDAY;
_tzset();
- dst = _daylight && _isdst(&tm);
+ dst = _isdst(&tm);
if (tm.tm_isdst == 0 || tm.tm_isdst < 0 && !dst) {
off = _timezone;