mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 09:38:42 +00:00
Merge branch 'conflicting_clocks_when_logging' into integration
This commit is contained in:
@@ -31,6 +31,14 @@ void RealTimeClock::dump_config() {
|
||||
|
||||
void RealTimeClock::synchronize_epoch_(uint32_t epoch) {
|
||||
ESP_LOGVV(TAG, "Got epoch %" PRIu32, epoch);
|
||||
// Skip if time is already synchronized to avoid unnecessary writes and log spam
|
||||
auto current = this->utcnow();
|
||||
if (current.is_valid()) {
|
||||
int32_t diff = static_cast<int32_t>(epoch) - static_cast<int32_t>(current.timestamp);
|
||||
if (diff >= -1 && diff <= 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Update UTC epoch time.
|
||||
#ifdef USE_ZEPHYR
|
||||
struct timespec ts;
|
||||
|
||||
Reference in New Issue
Block a user