I’m developing with ESP32 boards, and I’d like to use NTP. This has been provided through ‘time.h’, and mostly works. It updates, and I have a callback
void ntpCallback(timeval*) {
Serial.println("NTP UPDATED");
}
that I set with sntp_set_time_sync_notification_cb(ntpCallback);
However, sometimes, I get compiler errors that timeval
is not defined, and sntp_set_time_sync_notification_cb
is not defined. I can’t figure out when and why this happens - it was working fine, I moved some functionality around, now it doesn’t. If I walk into time.h
with VS Code, it has found it in .platformio/packages/framework-arduinoespressif32/tools/sdk/include/newlib/time.h
, and indeed it doesn’t have a struct timeval
or sntp_set_time_sync_notification_cb
.
Where does time.h
come from, and what might I need to do to figure out getting the right version going on?