On Sun, 2016-03-27 at 12:16 -0400, Michael Stone wrote:
> On Sun, Mar 27, 2016 at 02:34:26AM -0600, Bob Proulx wrote:
> > 
> > > 
> > > $ date -d 00:59
> > > Sun 27 Mar 00:59:00 GMT 2016
> > > $ date -d "Sun 27 Mar 00:59:00 GMT 2016"
> > > date: invalid date ‘Sun 27 Mar 00:59:00 GMT 2016’
> > Unfortunately that input is not in a locale independent format.  That
> > is why it cannot be read by date in the above.  The date documentation
> > says this:
> > 
> >  ‘-d DATESTR’
> >  ‘--date=DATESTR’
> >       Display the date and time specified in DATESTR instead of the
> >       current date and time.  DATESTR can be in almost any common format.
> >       It can contain month names, time zones, ‘am’ and ‘pm’, ‘yesterday’,
> >       etc.  For example, ‘--date="2004-02-27 14:19:13.489392193 +0530"’
> >       specifies the instant of time that is 489,392,193 nanoseconds after
> >       February 27, 2004 at 2:19:13 PM in a time zone that is 5 hours and
> >       30 minutes east of UTC.
> >       Note: input currently must be in locale independent format.  E.g.,
> >       the LC_TIME=C below is needed to print back the correct date in
> >       many locales:
> >            date -d "$(LC_TIME=C date)"
> >       *Note Date input formats::.
> > 
> > The "locale independent format" looks to be the problem in the above
> > to me.  But I think that is only your command line test as that is
> > different from what I see in the tzdata postinst.
> This is where I rant that the entire -d interface should be officially 
> deprecated because it is so broken, and replaced with something reliable 
> that doesn't implement a confusing mess of kinda-NLP. 
[...]

It's a bit late for that.  Still, there should be clear documentation
of which locale-independent input formats can be relied on (and they
should be covered by regression tests).

Ben.

-- 
Ben Hutchings
Beware of bugs in the above code;
I have only proved it correct, not tried it. - Donald Knuth

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to