mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
make human readable
This commit is contained in:
@@ -27,10 +27,14 @@ void RealTimeClock::dump_config() {
|
||||
#ifdef USE_TIME_TIMEZONE
|
||||
const auto &tz = get_global_tz();
|
||||
// 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) {
|
||||
ESP_LOGCONFIG(TAG, "Timezone: UTC%+d (DST UTC%+d)", -tz.std_offset_seconds / 3600, -tz.dst_offset_seconds / 3600);
|
||||
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);
|
||||
} else {
|
||||
ESP_LOGCONFIG(TAG, "Timezone: UTC%+d", -tz.std_offset_seconds / 3600);
|
||||
ESP_LOGCONFIG(TAG, "Timezone: UTC%+d:%02d", std_h, std_m);
|
||||
}
|
||||
#endif
|
||||
auto time = this->now();
|
||||
|
||||
Reference in New Issue
Block a user