Date/Time Library and millis() Overflow

I've been using the Date/Time Library with an NTP clock on a project lately. I have it re-sync with my NTP every hour and I find my drift over that hour is more then sufficient.

My question is related to the design of the library itself. It appears the Date/Time library is using millis() to keep it's time current. I don't see anything to handle the over flow of millis() which occurs about every ~54 days. Is there some compensation for this overflow spill in the library that I'm missing? I don't see anything in the documentation either.

which Date/Time library?

The overflow causes no issues that require any special handling if millis() us used properly....

Regards, Ray L.

Subtraction and unsigned math. If you do the math right you never have to worry about rollover. If that library was having issues we'd have heard about it by now and someone would have fixed it.

The official Arduino Time library. <TimeLib.h> Just curious. Like I said I don’t see anything in the documentation or in the code that appears to handle a spillover case with gaurds to prevent spilling over into another memory location. The subtraction issue appears to be covered fine in the library.

You don't need any guards. There cannot possibly be any spillover into other memory. I'm not sure what you even mean by that.

when millis() “overflow” it does not mean you start writing somewhere else in memory… it just means that after the 4,294,967,295 (2^32 - 1) milliseconds you go back to 0. it still fits within an unsigned long.

while (millis() - prevMillis >= 1000) { is safe way to deal with the moment of going back to zero in the way the unsigned arithmetic works (subtract, don’t add)