ESPDateTime icon indicating copy to clipboard operation
ESPDateTime copied to clipboard

Needs more explanation about usage/synchronisation

Open HubKing opened this issue 2 years ago • 4 comments

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?

HubKing avatar Dec 10 '23 14:12 HubKing

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;
  }

mianos avatar Dec 31 '23 22:12 mianos

How much does an ESP's timer generally deviate in a day?

HubKing avatar Dec 31 '23 23:12 HubKing

I have seen a second or so over time time. I don't know but it is just the 'vibe' to me.

mianos avatar Dec 31 '23 23:12 mianos