I want to use the internal clock to log some data. Yes I have read that it is not that accurate. I don't need seconds accuracy. I want to save the data every 6 min. My plan is/was to get the current time from NTP. Use that to set the internal clock. than once a day update the time keeping a log of how off the internal clock is. If necessary can go to updating every 12 hours. I found an old thread that uses time.h to read the internal clock but how do you set it.
Why not just schedule a task every 360000 milliseconds?
It could be as simple as blink without delay.
configTime(TIME_ZONE, "pool.ntp.org");
time_t now = time(nullptr);
while (now < SECS_YR_2000) {
delay(100);
now = time(nullptr);
}
setTime(now);
this sets the time for the Arduino Time library (TimeLib.h). the Time library uses millis() to count the time, but you can sync it with the RTC periodically. and the RTC will sync with NTP.
a complete sketch: TelnetStream/TelnetStreamEsp8266Test.ino at master · JAndrassy/TelnetStream · GitHub