last tv compilation error

This commit is contained in:
Anton Sergunov 2024-05-08 17:19:19 +00:00
parent 3d351ce6c5
commit db3266ac48

View file

@ -37,7 +37,7 @@ void SNTPComponent::setup() {
} }
sntp_setoperatingmode(SNTP_OPMODE_POLL); sntp_setoperatingmode(SNTP_OPMODE_POLL);
g_sync_callback = [this](struct timeval *tv) { g_sync_callback = [this](struct timeval *tv) {
static struct timeval time_val = tv ? *tv : {}; static struct timeval time_val;
switch (sntp_get_sync_status()) { switch (sntp_get_sync_status()) {
case SNTP_SYNC_STATUS_RESET: case SNTP_SYNC_STATUS_RESET:
ESP_LOGD(TAG, "Time sync reset"); ESP_LOGD(TAG, "Time sync reset");
@ -50,6 +50,8 @@ void SNTPComponent::setup() {
ESP_LOGD(TAG, "Time sync in progress"); ESP_LOGD(TAG, "Time sync in progress");
break; break;
} }
if (tv)
time_val = *tv;
}; };
sntp_set_time_sync_notification_cb(sntp_sync_time_cb); sntp_set_time_sync_notification_cb(sntp_sync_time_cb);
#endif #endif