Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/time



On Mon, Apr 06, 2015 at 07:10:27PM +0200, Alan Barrett wrote:
> On Mon, 06 Apr 2015, Brian Ginsbach wrote:
> >Module Name:	src
> >Committed By:	ginsbach
> >Date:		Mon Apr  6 14:38:22 UTC 2015
> >
> >Modified Files:
> >	src/lib/libc/time: strptime.3 strptime.c
> >
> >Log Message:
> >Add UTC as a synonym for GMT (%Z).  [from FreeBSD]
> 
> The %z format (which is distinct from %Z) already accepts "GMT" and "UT".
> If we are going to accept "UTC" as well, which I think is a good idea, then
> please allow both %z and %Z to accept all three of UT, UTC, and GMT.

It wasn't added to %Z (originally) as it wasn't (isn't) in the
"classic" three letter time zone, "zoneinfo style".  "UTC" is in
the "classic" three letter time zone, "zoneinfo style".

That %z accepts "GMT" and "UT" not "UTC" is that "UTC" isn't
specified in RFC-822/RFC-2822.  Maybe not the best reason but there
it is.  Maybe it should ("be liberal in what you accept").  Now
since these are NetBSD extensions it probably wouldn't hurt to have
both %z and %Z understand GMT, UT, UCT (yet another alias), and
UTC.

An interesting aside, the GNU C Library simply ignores the string
specified for %Z (makes no conversion and simply advances to the
next whitespace).  FreeBSD, NetBSD, and MacOS X all treat an unknown
(non-local TZ and not "GMT") time zone as an error and stop parsing.

--
Brian Ginsbach


Home | Main Index | Thread Index | Old Index