On Fri 01 May 2015 at 19:41:00 +0000, Brian Ginsbach wrote:
> a. strptime(str, "%H %p", &tm)
>
> Currently if str contains 0-11, for the hour, and a am/pm string
> the time will be adjusted accordingly. However if the str
> contains 12-23, for the hour, and a am/pm string strptime(3)
> returns NULL (error). This seems inconsistent if not a bug.
Excluding 12 can be (somewhat) defended because "12 pm" and "12 am" are
considered by some to be ambiguous: which is noon and which is midnight?
I didn't check if the "disallow hour=12" behaviour is the same for
strptime(str, "%H:%M %p", &tm)
and str="12:01 pm". That should be a sort-of valid time[1].
More generally, I would think that it may be not-too-stupid to allow
times in a 24-hour clock like "1:01 am" and "13:01 pm" but disallow
"1:01 pm" and "13:01 am": allow am/pm as long as it doesn't contradict
the 24-hour clock.
None of this is based on reading any standard, just applying my own
ideas of the POLA.
[1] as far as any time with am/pm can be a valid time; note the
completely stupid^Wunintuitive and maddeningly unnecessarily-complexity-
adding notion that 1:01 pm is AFTER 12:59 pm...
-Olaf.
--
___ Olaf 'Rhialto' Seibert -- The Doctor: No, 'eureka' is Greek for
\X/ rhialto/at/xs4all.nl -- 'this bath is too hot.'
Attachment:
pgpX5_XysnzkV.pgp
Description: PGP signature