Michael's Project Blog

Pool Fill: SNTP Client

TimeLib and the Timezone library don't really work together like the Timezone examples imply. All of the TimeLib transformation functions use the currently stored TimeLib value. If TimeLib is tracking UTC then all of the transformation functions will only work for UTC. The approach here will be to place the Timezone library functions into the TimeLib SyncProvider function. Every time the SyncProvider is called it will grab the UTC time from the ESP library and convert it to local time before returning that time to TimeLib. TimeLib will always track local time. This has one potential side-effect. At the DST shift, the time returned by now() (i.e. sysTime) will jump forward or backward causing any timing functions that use now() to possibly break. This is user beware.... Timing functions should use the Arduino millis() function for checking elapsed time! See this for an overview of timing best practices: How can I handle the millis() rollover?

Need to debug the scheduler for days past sunday. Found a real doozie of an error and corrected it but the fix is untested.

Always set the clock to a date past 1/1/1971 or the schedule timing functions will not work correctly. The best thing here is to force the clock to something like 1/1/2017 at startup; then free run from there until something sets the time.

Need code to handle inhibit > unix epoc rollover; also scheduling for the week following the unix epoc rollover needs to be studied.

On a DST spring forward; anything scheduled between 2am and 3am will be skipped.
On a DST fall back; anything scheduled between 1am and 2am will be scheduled twice.

remainingRunTime will also break across the shift