I have managed to fix it by using the low level esp_sntp API.
static const char *TAG = "sntp_init";
static const ip_addr_t ntp_addr = IPADDR4_INIT_BYTES(192, 168, 178, 1);
SemaphoreHandle_t sntp_sem = NULL;
static void time_sync_notification_cb(struct timeval *tv) {
ESP_LOGI(TAG, "Time ...
Search found 2 matches
- Tue Sep 02, 2025 6:42 pm
- Forum: ESP-IDF
- Topic: esp_netif_sntp_sync_wait returns early
- Replies: 1
- Views: 459
- Tue Sep 02, 2025 3:36 pm
- Forum: ESP-IDF
- Topic: esp_netif_sntp_sync_wait returns early
- Replies: 1
- Views: 459
esp_netif_sntp_sync_wait returns early
Hello,
I have been trying to get SNTP to work, however when i call esp_netif_sntp_sync_wait, it returns before the time is actually set (time() returns 0).
Using the log output i can see that the time synchronizes successfully, after the function returns:
I (9830) wifi_init: Got IP: 192.168.178 ...
I have been trying to get SNTP to work, however when i call esp_netif_sntp_sync_wait, it returns before the time is actually set (time() returns 0).
Using the log output i can see that the time synchronizes successfully, after the function returns:
I (9830) wifi_init: Got IP: 192.168.178 ...