From db3266ac480d7f2973cd8a6c279269e2525f2918 Mon Sep 17 00:00:00 2001 From: Anton Sergunov Date: Wed, 8 May 2024 17:19:19 +0000 Subject: [PATCH] last tv compilation error --- esphome/components/sntp/sntp_component.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/sntp/sntp_component.cpp b/esphome/components/sntp/sntp_component.cpp index 1496971321..87e1868b96 100644 --- a/esphome/components/sntp/sntp_component.cpp +++ b/esphome/components/sntp/sntp_component.cpp @@ -37,7 +37,7 @@ void SNTPComponent::setup() { } sntp_setoperatingmode(SNTP_OPMODE_POLL); g_sync_callback = [this](struct timeval *tv) { - static struct timeval time_val = tv ? *tv : {}; + static struct timeval time_val; switch (sntp_get_sync_status()) { case SNTP_SYNC_STATUS_RESET: ESP_LOGD(TAG, "Time sync reset"); @@ -50,6 +50,8 @@ void SNTPComponent::setup() { ESP_LOGD(TAG, "Time sync in progress"); break; } + if (tv) + time_val = *tv; }; sntp_set_time_sync_notification_cb(sntp_sync_time_cb); #endif