Re: Calculating Daylight Saving Time
Unless you have a calendar you’d still want the data table anyway.
Any time you want to add or subtract time you need a calendar.
If the clock retrieves UTC time as 00:01 1st Jan 2016, and has to subtract one hour.
It has to know right down to days in month, leap years, the whole lot.
In my case I don't care about the date or year etc (other than to be used in the calculation to determine if DST is in effect or not)
and my code does not require the year for the calculation. I just needed the month, date and day of week to run through my algorithm.
My clock simply displays HH:MM, the seconds are still tracked to know when to increment the minutes.
My code checks NTP time twice a day (at 0500 and 1500) and runs the calc.
The reason I don't check it 12 hours apart is because I want it to be most accurate first thing in the morning and when I get home from work.
The display is blank between 2200 and 0600.
As noted above the ESP module give me the time in STD time and then my code determines if I need to add 1 hour or leave the time as is.
So far it seems to be working correctly.
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Bookmarks