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.
Search the internet for the source to the 'C' library function mktime().
The magic Google phrase for calculating the day of the week is "Zeller's Congruence". http://www.lysator.liu.se/faq/c-faq/c-17.html#17-28
dayofweek(y, m, d) /* 0 = Sunday */ int y, m, d; /* 1 <= m <= 12, y > 1752 or so */ { static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; y -= m < 3; return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7; }
Thanks Drew for the code.