Subject: bug#6132: bug in date: --rfc-3339=TIMESPEC option doesn't print 'T'

From: "F. Alexander Njemz" <[email-masked]>
Date: Fri, 07 May 2010 15:25:53 +0200

Hi,

as evidenced here [1] the slightly ambiguous wording in the RFC 3339 [2]
seems to be the reason that the date utility using the 
--rfc3339=TIMESPEC switch formats the date with a space instead of a 'T'.

I was confused as well, so I took the liberty to mail the authors of the
RFC in question. I attached the reply from Mr. Klyne.

There is also a patch attached.

Regards,

F. Alexander Njemz

[1] http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00014.html

[2] http://www.ietf.org/rfc/rfc3339.txt

Subject: Re: rfc3339 is the T mandatory?
From: Graham Klyne <[email-masked]>
To: "F. Alexander Njemz" <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Fri, 07 May 2010 13:05:41 +0100

In short: "yes"

Per section 5.5, the intent in this draft was to specify a timestamp format 
using elements from and compatible with 8601, but eliminating as far as 
reasonable any variations that could make timestamp data harder to process. 
This includes making the 'T' mandatory in date+time values.

#g
--

F. Alexander Njemz wrote:
> Dear Sirs,
> 
> there seems to be some confusion about the interpretation of the 
> following passages
> of RFC 3339:
>     in section 5.6:
>         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.
>     and in Appendix A:
>         ISO 8601 states that the "T" may be omitted under some
>         circumstances.  This grammar requires the "T" to avoid ambiguity.
> 
> So, what I would like to ask is if the "T" is mandatory for RFC 3339 
> conformance or not?
> 
> Thanks in advance.
> 
> Regards,
> 
> F. Alexander Njemz
> 

>From ad52a8983b8bc3c5a1808e9ed2bec9930e9c8210 Mon Sep 17 00:00:00 2001
From: F. Alexander Njemz <[email-masked]>
Date: Fri, 7 May 2010 10:55:36 +0200
Subject: [PATCH] date: fixed rfc-3339 format strings

* src/date.c (main): Insert a 'T' between date and time in rfc-3339
format strings as specified by the rfc.
---
 src/date.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/date.c b/src/date.c
index c39adb1..daeaf0d 100644
--- a/src/date.c
+++ b/src/date.c
@@ -343,8 +343,8 @@ main (int argc, char **argv)
             static char const rfc_3339_format[][32] =
               {
                 "%Y-%m-%d",
-                "%Y-%m-%d %H:%M:%S%:z",
-                "%Y-%m-%d %H:%M:%S.%N%:z"
+                "%Y-%m-%dT%H:%M:%S%:z",
+                "%Y-%m-%dT%H:%M:%S.%N%:z"
               };
             enum Time_spec i =
               XARGMATCH ("--rfc-3339", optarg,
-- 
1.7.0.4