+1
NTP is built into the new ESP core.
The libraries for the NTP code can be removed and the code reduced to a few lines.
This is basically all you need.
#include <WiFi.h> // ESP32
time_t now; // epoch
tm tm; // time struct
void setup() {
configTzTime("CET-1CEST,M3.5.0,M10.5.0/3", "de.pool.ntp.org"); // https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
}
void loop() {
time(&now); // epoch
localtime_r(&now, &tm); // local offset
}
No NTPClient, no timeClient, no WiFiUDP etc.
The structure elements tm.tm_hour, tm.tm_min, tm,tm_sec now contain the time.
Leo..