bug#39693: Sv: bug#39693: Any chance of fixing --rfc-3339 to conform to the standard?

2020-02-21 Thread Paul Eggert

On 2/20/20 11:56 PM, Mads Bondo Dydensborg wrote:

Your statement is in conflict with the message exchange, referenced by the bug 
I linked to, with, as I understand it, the authors of the standard:


Not really. In that email exchange one of the authors of the RFC 
mentioned a goal of the RFC. The part of the RFC that I quoted, though, 
is an explicit exception to that particular goal. The RFC had several 
goals, they sometimes conflicted, and the RFC's text was a compromise. I 
was involved with the drafting of the RFC, and remember the history 
reasonably well.



The ISO output from date can not be used, as it uses a "," as fractional 
separator


You can use the following if you want subsecond resolution with both 'T' 
and '.':


date '+%Y-%m-%dT%H:%M:%S.%N%:z'

This won't work for some historical timestamps (e.g., the Netherlands 
before 1937) but RFC 3339 doesn't support them anyway so it's probably 
good enough.






bug#39693: Sv: bug#39693: Any chance of fixing --rfc-3339 to conform to the standard?

2020-02-21 Thread Mads Bondo Dydensborg
Hi again


Your statement is in conflict with the message exchange, referenced by the bug 
I linked to, with, as I understand it, the authors of the standard:


https://debbugs.gnu.org/cgi/bugreport.cgi?msg=11;filename=rfc3339+is+the+T+mandatory%3F.eml;att=1;bug=6132


The date-time production in rfc-3339 clearly includes a literal "T".


All examples in rfc-3339 includes a T.


The ISO output from date can not be used, as it uses a "," as fractional 
separator (which is preferred in ISO8601:2004), where rfc-3339 specifies a ".". 
So, no dice, the output

date --iso-8601=ns

is not a valid rfc-3339 datetime with fractionalparts.


It truly is a mess, IMHO, but adding T to the rfc-3339 output would, AFACIT, 
make it conform to the ABNF in section 5.6 of rfc-3339, which can't be a bad 
thing.


Kind regards


Mads



Fra: Paul Eggert 
Sendt: 20. februar 2020 17:16:43
Til: Mads Bondo Dydensborg
Cc: 39...@debbugs.gnu.org
Emne: Re: bug#39693: Any chance of fixing --rfc-3339 to conform to the standard?

On 2/20/20 4:39 AM, Mads Bondo Dydensborg wrote:
> As have been established in 2006 and again in 2010, the rfc-3339 mandates the 
> use of "T" in a single field timestamp.

No, RFC 3339 explicitly allows the use of space. It says:

   NOTE: ISO 8601 defines date and time separated by "T".
   Applications using this syntax may choose, for the sake of
   readability, to specify a full-date and full-time separated by
   (say) a space character.

This paragraph was put into the RFC at my suggestion, precisely so that GNU
"date" output wouldn't have to contain that "T".

Tf you want GNU 'date' to output the 'T', you can use 'date --iso-8601=s'
instead of 'date --rfc-3339=s'. That's the point of having these two options for
GNU 'date'. If it weren't for this difference in behavior, GNU 'date' wouldn't
have needed a --rfc-3339 option in the first place, and we shouldn't change the
meaning of --rfc-3339 to eviscerate the whole point of the option.