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

Poul-Henning Kamp phk at phk.freebsd.dk
Sat Jul 16 18:22:43 EDT 2005


In message <000701c58a53$815e80a0$0500a8c0 at darius.domain.actdsltmp>, "Bill Hawk
ins" writes:

>Um, would you care to point out the more serious bugs?

1. Leap-seconds can happen at the end of any month.  Preference is
   given to june+december and after that march+september.

2. Leap-seconds can add or delete a second.

3. You apply the leap second one second too early.

4. Your code does not work correctly if the system is not turned
   on at the moment of the leap-second.

5. Your code does not work unless somebody manually sets the
   leapsecond flag.

6a.Your code has no provision for recording and rendering a timestamp
   at an arbitrary time.

or

6b.Your code has no provision for calculating a time interval from
   two timestamps spanning one or more leap-seconds.

7. Your code has no handling of setting/adjusting the clock across
   a leap-second.

Poul-Henning


>-----Original Message-----
>From: phk at phk.freebsd.dk [mailto:phk at phk.freebsd.dk]
>Sent: Saturday, July 16, 2005 3:47 PM
>To: bill at iaxs.net; Discussion of precise time and frequency measurement
>Subject: Re: [time-nuts] Re: UTC - A Cautionary Tale
>
>
>In message <001c01c58a46$527573a0$0500a8c0 at darius.domain.actdsltmp>, "Bill
>Hawk
>ins" writes:
>
>>Garbage is in the eye of the beholder.
>
>Indeed.
>
>That your "I'm gonna show those morons!!!" example contains serious
>bugs in the leap second handling makes this one of my most treasured
>emails in this entire debate.
>
>Welcome to category 3) Bill, now please don't waste more time.
>
>Poul-Henning
>
>
>>/* Main Time Routine */
>>
>>/* User must set a Leap Second switch when notified of same. */
>>/* Use a signed number for the switch if you think it will  */
>>/* jump ahead one second. */
>>
>>/* Handle one second interrupt */
>>UTC += 1;
>>
>>/* Handle Local Time from user-entered parameters, just like MS does */
>>Local Time = UTC + Local Time Offset;
>>
>>/* Handle leap second in UTC and local. Clock doesn't do 60 */
>>If Leap Second switch is set {
>>   If (UTC is 30 Jun 23:59:59 || UTC is 31 Dec 23:59:59) {
>>      Subtract leap second from UTC;
>>      Subtract Leap second from Local Time;
>>      Turn off leap second switch;
>>   }
>>}
>>/* Handle time shifts from user-entered parameters */
>>If Local Time matches Spring Ahead {
>>   Local Time += Spring Ahead Increment;
>>   Add one year to Spring Ahead;
>>}
>>If Local Time matches Fall Back {
>>   Local Time -= Spring Ahead Increment;
>>   Add one year to Fall Back;
>>   }
>>
>>/* End main time routine */
>
>--
>Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
>phk at FreeBSD.ORG         | TCP/IP since RFC 956
>FreeBSD committer       | BSD since 4.3-tahoe
>Never attribute to malice what can adequately be explained by incompetence.
>
>
>_______________________________________________
>time-nuts mailing list
>time-nuts at febo.com
>https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.




More information about the time-nuts mailing list