J. Nick Koston 38e3095e35 [time] Fix strftime %Z and %z returning GMT/+0000 instead of actual timezone
Since the timezone bloat elimination (#13635) removed setenv("TZ")/tzset()
on embedded platforms, libc's ::strftime no longer has access to timezone
state for %Z and %z format specifiers. The time values (hour, minute, etc.)
are correct since they come from our custom timezone parser via struct tm
fields, but %Z and %z read from libc's internal _tzname/_timezone which
are stuck at GMT/+0000.

Fix by substituting %Z and %z in the format string with the correct
"+HHMM"/"-HHMM" designation computed from our parsed timezone offset
before passing to ::strftime. The substitution only runs when %Z or %z
are present in the format string, so there is no overhead for the common
case.

Also refactors strftime_to() to delegate to strftime() instead of
duplicating the ::strftime call, ensuring both code paths get the fix.
2026-03-30 21:26:23 -10:00
2023-06-12 17:00:34 +12:00
2026-03-31 13:08:50 +13:00
2022-09-06 15:48:01 +12:00
2025-12-21 09:26:03 -05:00
2024-03-28 10:20:51 +13:00
2025-07-17 22:40:28 +12:00
2025-12-08 14:37:45 -05:00
2026-03-12 07:34:53 +13:00
2025-07-17 22:40:28 +12:00
S
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme Multiple Licenses 546 MiB
Languages
C++ 60.1%
Python 39.3%
C 0.3%
JavaScript 0.2%