ESPDateTime
ESPDateTime copied to clipboard
Needs more explanation about usage/synchronisation
So.... if I call DateTime.begin() once in setup() just like the top page's example, does it periodically re-synchronise the time, or does it only do that once at begin() and never re-synchronise?
No, seems you need to call begin() again.
unsigned long lastInvokeTime = 0;
const unsigned long dayMillis = 24UL * 60 * 60 * 1000; // Milliseconds in a day
...
// in loop()
if (currentMillis - lastInvokeTime >= dayMillis) {
DateTime.begin(1000);
lastInvokeTime = currentMillis;
}
How much does an ESP's timer generally deviate in a day?
I have seen a second or so over time time. I don't know but it is just the 'vibe' to me.