This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Dayligh saving time Code

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.

Parents
  • 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.

Reply
  • 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.

Children