This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] In do_get_time, %S from 0 to 59, or 60, or even 61?!?
- From: Martin Sebor <sebor at roguewave dot com>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 27 Aug 2004 09:33:48 -0600
- Subject: Re: [RFC] In do_get_time, %S from 0 to 59, or 60, or even 61?!?
- References: <412F12FB.6010705@suse.de>
Paolo Carlini wrote:
Hi,
in do_get_time, when we encounter %S we reject anything bigger than
59... However,
the C99 standard is very clear about the leap-second issue that leads to
60 being also
a valid value both in strftime and in tm.tm_sec. AFAIK, C89 even
consider ok *two*
leap seconds, up to 61, crazy...
Correct. C99 changed it to 60 (see 7.23, p4).
Shall we at least accept 60 too? I'm tempted to think so, since
otherwise we may
be unable to read back the output of by time_put (which uses internally
just strftime!)
In alignment with C99, POSIX (SUSv3) strptime() accepts values
in the range [0,60]. Being based on C89, SUSv2 accepts [0,61].
I would do whatever strftme()/strptime() does on each platform.
FWIW, here's an interesting paper on the history of the leap
second:
http://www.cl.cam.ac.uk/~mgk25/time/metrologia-leapsecond.pdf
Martin