[H-GEN] time in C/C++

Frank Brand fbrand at uq.net.au
Wed Dec 29 00:59:19 EST 1999


[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics.  Please observe the list's charter.          ]

On Wed, 29 Dec 1999, Anthony Towns wrote:

> 
> time_t's ignore leap seconds. (If you're doing stuff with times *during*
> a leap second, and you're using ntp or something similar that will tell you
> about leap seconds, your time will go from 23:59:59 to 23:59:60 to 23:00:00,
> with the time_t's of the latter two being the same.
> 
> Intriguingly, according to the time(2) manpage:
> 
> NOTES
>        POSIX.1  defines  seconds since the Epoch as a value to be
>        interpreted as the number of seconds between  a  specified
>        time  and the Epoch, according to a formula for conversion
>        from UTC equivalent to conversion on the naïve basis  that
>        leap  seconds are ignored and all years divisible by 4 are
>        leap years.
> 
> Note: *all* years divisible by 4 are leap years. No 100 or 400 rule.
> 
> Whether this is true or not is another matter...

Yes, these are the two aspects to which I was referring, the second regarding
leap years is more of a potential problem than the first to me. The first might
result in a few seconds error but the second might, in some circumstances,
result in a more significant error although, in practical terms, it would be a
long while before it would be a problem. Under this arrangement 2000 would be
treated as a leap year and the next error might not occur until the year 2100
which would be treated as a leap year when, in fact it is not.

--
Frank Brand
E-mail: fbrand at uq.net.au
Home Page: http://www.uq.net.au/~zzfbrand

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list