Library for time zone conversions and automatic DST adjustments

robtillaart:
Very usefull as there are many questions about getting the time zone right (after I had written an NTP-RTC article on the playground).

I am wondering about the DST algorithm, does it include Europe? did not dive into the code yet :slight_smile:

Hi Rob, yes it should work for Europe, see the "WorldClock" example supplied with the library. The examples should work right out of the box on a bare Arduino. Glad to have you kick the tires, let me know if you find issues!

Should also work in the Southern hemisphere, I knew Nick would never let me live it down otherwise :wink:

The algorithm works from rules that you supply. For example, US Eastern Daylight Time, which has a UTC offset of -240 minutes, starts on the 2nd Sunday in March at 02:00 local time. So the rules are coded, in pairs, like this:

TimeChangeRule usEdt = {"EDT", Second, Sun, Mar, 2, -240};    //UTC - 4 hours
TimeChangeRule usEst = {"EST", First, Sun, Nov, 2, -300};     //UTC - 5 hours

I was pulling my hair out at one point during testing but discovered I had the rules wrong! :blush: