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

Bill Hawkins bill at iaxs.net
Sat Jul 16 18:12:50 EDT 2005

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


-----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
ins" writes:

>Garbage is in the eye of the beholder.


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.


>/* 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.

More information about the time-nuts mailing list