This commit is contained in:
J. Nick Koston
2026-01-29 21:19:00 -06:00
parent aad3764806
commit d37c37ef62
2 changed files with 23 additions and 3 deletions
+6 -2
View File
@@ -90,8 +90,12 @@ void RealTimeClock::synchronize_epoch_(uint32_t epoch) {
#ifdef USE_TIME_TIMEZONE
void RealTimeClock::apply_timezone_() {
setenv("TZ", this->timezone_.c_str(), 1);
tzset();
// Parse the POSIX TZ string using our custom parser to avoid pulling in scanf (~7.6KB)
if (!parse_posix_tz(this->timezone_.c_str(), this->parsed_tz_)) {
ESP_LOGW(TAG, "Failed to parse timezone: %s", this->timezone_.c_str());
// Reset to UTC on parse failure
this->parsed_tz_ = ParsedTimezone{};
}
}
#endif