1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00
This commit is contained in:
J. Nick Koston
2026-01-30 01:09:30 -06:00
parent f317f58545
commit 9f3e5f990f
2 changed files with 3 additions and 6 deletions

View File

@@ -364,10 +364,9 @@ bool parse_posix_tz(const char *tz_string, ParsedTimezone &result) {
const char *p = tz_string;
// Initialize result
// Initialize result (dst_start/dst_end default to type=NONE, so has_dst() returns false)
result.std_offset_seconds = 0;
result.dst_offset_seconds = 0;
result.has_dst = false;
result.dst_start = {};
result.dst_end = {};
@@ -429,9 +428,7 @@ bool parse_posix_tz(const char *tz_string, ParsedTimezone &result) {
return false;
}
// Only set has_dst after successfully parsing both rules
result.has_dst = true;
// has_dst() now returns true since dst_start.type was set by parse_dst_rule
return true;
}

View File

@@ -29,7 +29,7 @@ void RealTimeClock::dump_config() {
// POSIX offset is positive west, negate for conventional UTC+X display
int std_h = -tz.std_offset_seconds / 3600;
int std_m = (std::abs(tz.std_offset_seconds) % 3600) / 60;
if (tz.has_dst) {
if (tz.has_dst()) {
int dst_h = -tz.dst_offset_seconds / 3600;
int dst_m = (std::abs(tz.dst_offset_seconds) % 3600) / 60;
ESP_LOGCONFIG(TAG, "Timezone: UTC%+d:%02d (DST UTC%+d:%02d)", std_h, std_m, dst_h, dst_m);