[time-nuts] Re: UTC - A Cautionary Tale

Mike S mikes at flatsurface.com
Sat Jul 16 22:44:05 UTC 2005


At 06:12 PM 7/16/2005, Bill Hawkins wrote...
>Um, would you care to point out the more serious bugs?
>
>Bill

The UTC time sequence with your code would go (at the 1 second interrupts):

23:59:59.0
23:59:59.0
00:00:00.0

Leading to ambiguous (duplicated) timestamps. The correct solution is closer to:

   Disable interrupts;
   ... 
   If (UTC is [last day of any month] 23:59:59 || leap second is negative) {
      UTC = [next day] 00:00:00;
      Clear leap second }
   If (UTC is 1 [any month] 00:00:00) || leap second is positive) {
      UTC = [prior day] 23:59:60;
      Clear leap second }

Which of course requires applications and the clock itself to be able to handle 23:59:60 (which is a legitimate time in UTC). Routines which calculate time intervals also require that a table be kept of when leap seconds occur, so they can be accounted for.





More information about the Time-nuts_lists.febo.com mailing list