Subject: Re: CVS commit: src/sys/kern
To: Alan Barrett <apb@cequrux.com>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: source-changes
Date: 09/12/2006 08:18:37
Alan Barrett wrote:
> On Mon, 11 Sep 2006, Perry E. Metzger wrote:
>   
>> Garrett D'Amore <gdamore@netbsd.org> writes:
>>     
>>> Modified Files:
>>> 	src/sys/kern: kern_todr.c
>>>
>>> Log Message:
>>> Allow for leap seconds.
>>>       
>> I would have thought 61 was sufficient. Is 62 really possible?
>>     
>
> In reality, there will never be more than one leap second in a given
> minute.
>
> The C89 standard accidentally made allowance for two leap seconds,
> saying that the tm_sec field of struct tm could contain values in the
> range 0 to 61.  This old thread from comp.stc.c discusses the issue:
> <http://groups.google.co.uk/group/comp.std.misc/browse_thread/thread/9ebfaed74bffb281/c9babd4663808f0f?lnk=gst&q=tm_sec+leap&rnum=9>
>
> That error seems to have spread to other APIs.  For example, time.h in
> SUSv2 <http://www.opengroup.org/onlinepubs/007908799/xsh/time.h.html>
> allows for a double leap second.
>
> C99 fixes this, saying that tm_sec contains values in the range 0 to 60
> (ISO 9899:1999 section 7.23.1).
>   
> --apb (Alan Barrett)
>   

Thanks.  I am convinced that you're right, this is a historical error,
and I will correct it shortly.  I am grateful that I don't look like an
idiot for suggesting there _could_ have been a double leap second.  (At
least if I'm an idiot, I'm not alone, anyway. :-)

-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191