bug-coreutils
[Top][All Lists]
Advanced

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

Re: date not parsing full iso-8601


From: Eric Blake
Subject: Re: date not parsing full iso-8601
Date: Tue, 13 Sep 2005 21:30:24 -0600
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paul Eggert on 9/13/2005 4:16 PM:
> 
> OK, I installed the patch below.  Comments welcome.  In particular,
> the new %:z, %::z, %:::z strftime formats are a bit weird-looking, but
> I couldn't think of anything better.

All I could think of when the problem first came up was %Ez, since %E
specifies alternate format, but that doesn't really fit the three formats
you provided, so your choice seems great to me.

> 2005-09-13  Paul Eggert  <address@hidden>
> 
>       * NEWS: date has a new --rfc-3339 option, and the old --iso-8601
>       option is deprecated.  date and ls also have new time format
>       specifiers %:z, %::z, %:::z.
>       * doc/coreutils.texi (Time conversion specifiers, Options for date):
>       Document date --rfc-3339 and new specifiers %:z, %::z, %:::z.  Use
>       "date and time" consistently; the old version sometimes said "time
>       and date".  Fix a minor bug in the documentation for --rfc-2822:
>       it claimed day-of-month < 10 had leading space, not leading zero.
>       Use a consistent format for terms like "RFC".
>       * lib/strftime.c (my_strftime): Add support for %:z, %::z, %:::z.
>       Fix bug in formats like %2N.
>       * src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so
>       remove the "=1".
>       (TIME_SOEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put
              ^^^^
typo in the changelog

>       them there.
>       (time_spec_string, time_spec): Hours and minutes must be at
>       start now, so put them there.
>       (rfc_2822_format): Now a string constant, not a boolean.  All uses
>       changed.
>       (iso_8601_format, rfc_format): Remove.
>       (RFC_3339_OPTION): New constant.
>       (long_options): Add --rfc-3339.
>       (usage): Add --rfc-3339.  Don't mention --iso-8601.
>       Mention %:z, %::z, %:::z.
>       (main): Simplify calculation of 'format'; it was getting too hairy
>       to follow.  Add --rfc-3339.
>       (show_date): Assume format arg is not NULL, which is the case
>       now.  The default code is moved to 'main'.  This simplifies things
>       and allows the default to be calculated just once.
>       * tests/misc/date: Add tests for --rfc-3339.
> 
> Index: NEWS
> ===================================================================
> RCS file: /fetish/cu/NEWS,v
> retrieving revision 1.308
> diff -p -u -r1.308 NEWS
> --- NEWS      10 Sep 2005 14:07:59 -0000      1.308
> +++ NEWS      13 Sep 2005 21:59:04 -0000
> @@ -182,6 +182,11 @@ GNU coreutils NEWS                      
>  
>    cp and mv: the --reply=X option is deprecated
>  
> +  date accepts the new option --rfc-3339=TIMESPEC.  The old --iso-8602 (-I)
> +  option is deprecated; it still works, but new applications should avoid it.
> +  date and ls's time formats now support new %:z, %::z, %:::z specifiers
> +  for numeric time zone offsets like -07:00, -07:00:00, and -07.

What about du, pinky, pr, stat, and who, which also use a form of
strftime?  And what about the FIXME in uptime to use strftime?

>  
> address@hidden address@hidden
> address@hidden address@hidden
> address@hidden address@hidden
> address@hidden address@hidden
> -Display the date using the @acronym{ISO} 8601 format, @samp{%Y-%m-%d}.

Now that -I is deprecated, should it print a warning to stderr?  Or just
silently work for a couple of years until it is disabled?

> +      --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.\n\
> +                            TIMESPEC=`date', `seconds', or `ns' for\n\
> +                            date and time to the indicated precision.\n\

TIMESPEC was optional for -I; should it be optional for rfc-3339 as well?

>        fputs (_("\
> -  %z   numeric timezone (e.g., -0400)\n\
> +  %z   +hhmm numeric timezone (e.g., -0400)\n\
> +  %:z  +hh:mm numeric timezone (e.g., -04:00)\n\
> +  %::z +hh:mm:ss numeric time zone (e.g., -04:00:00)\n\
> +  %:::z numeric time zone with : to necessary precision (e.g., -04, 
> +05:30)\n\

I think the description of :, ::, and ::: would fit better in the optional
flags section below, rather than having to respace all the interpreted
%<letter> sequence listings because you listed them with %z.

> Index: tests/misc/date
> ===================================================================
> RCS file: /fetish/cu/tests/misc/date,v
> retrieving revision 1.12
> diff -p -u -r1.12 date
> --- tests/misc/date   9 Sep 2005 07:22:27 -0000       1.12
> +++ tests/misc/date   13 Sep 2005 21:59:08 -0000
> @@ -166,19 +166,29 @@ my @Tests =

Where are the tests for %::z and %:::z?

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDJ5lQ84KuGfSFAYARAlZdAJ9w3pm2nR1ldE0Atan5DQARcJk8EwCfYRTu
jkHWqv3k8jz8WanPBYX6oRs=
=MbGV
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]