I'm playing about with a Dallas RTC iButton DS1994. I have a query about the Maxim suggested algorithm for converting time to seconds. I'm obviously missing a subtlety, I just can't see what it is. My Algorithm to convert datetime to seconds. Using year 2000 as year zero. elapsed_days =365 * (year-2000) + LeapDay(1) + no_of_whole_month_days + number_of_current_month_days + LeapFlag - 1 elapsed_seconds= 86400 * elapsed_days + secs + (60 * minutes) + (3600 * hours) Maxim/Dallas have the following method Sv = td->year + 32 - 2000; I don't understand the reason for the 32. Xv = 365 * (Sv-2) + (Sv-1)/4 + dm[td->month] + td->day + Bv - 1; Xv = 86400 * Xv + (ulong)(td->second) + 60*((ulong)(td->minute) + 60*(ulong)(td->hour)); I can't see why they have the Sv-2 and Sv-1/4 correction. There is an error in there program I noticed the hours should be multiplied by 3600 and not as they have 60. They use 1970 as year zero. At this moment I can only assume the 32 is a type of error correction mechanism in case of transmission failure. The Leap year flag is calculated earlier on in the program. After this I just hope everything will fit into my 873. any thoughts much appreciated. Colin -- cdb, cdb@barnard.name on 31/03/2002 -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu