Hi, Any one out there have C example code on daylight saving time.? I already have r/w date_Time(), two date_compare() routines based on dallas DS1302. Thanks.
Considering all the exceptions to the rules just in the US, I'm not sure you could fit it into an 8051. (Do you really need to account for the fact that Starke County, Kentucky, was in Central Time until 1991, when it became Eastern? Which part of Indiana are you in?) There's always http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdtime/ That's probably overkill. If you want the simple rule for the US, DST begins at 2 am on the first Sunday in April and ends at 2 am on the last Sunday in October. Figuring out the first/last Sunday should be straightforward if you calculate the day number for day 1 and then do some mod arithmetic.
Would it be simpler to include a radio time code receiver?
All I need some code to do that arithmetic. Time is already set & running in the machine according to its loaction/state. A piece of code s/b able to set clock one hour back/ahead according to October/April's sundays.