mirror of
https://github.com/esphome/esphome.git
synced 2025-03-14 04:25:15 +01:00
Don't use swap
This commit is contained in:
parent
e14cd7e6ab
commit
4f0b0ed952
1 changed files with 2 additions and 3 deletions
|
@ -101,11 +101,10 @@ void SNTPComponent::loop() {
|
|||
#ifdef USE_ESP_IDF
|
||||
if (sync_time_to_report_ != 0) {
|
||||
this->cancel_timeout(FORCE_UPDATE_SCHEDULE);
|
||||
time_t time_to_report = 0;
|
||||
std::swap(sync_time_to_report_, time_to_report);
|
||||
const ESPTime time = ESPTime::from_epoch_local(time_to_report);
|
||||
const ESPTime time = ESPTime::from_epoch_local(sync_time_to_report_);
|
||||
ESP_LOGD(TAG, "Synchronized time: %04d-%02d-%02d %02d:%02d:%02d", time.year, time.month, time.day_of_month,
|
||||
time.hour, time.minute, time.second);
|
||||
sync_time_to_report_ = 0;
|
||||
}
|
||||
#else
|
||||
if (this->has_time_)
|
||||
|
|
Loading…
Add table
Reference in a new issue