git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: junkio@cox.net, git@vger.kernel.org
Subject: Re: [PATCH] Support output ISO 8601 format dates
Date: Sun, 15 Jul 2007 23:23:59 +0200	[thread overview]
Message-ID: <20070715212359.GB18293@efreet.light.src> (raw)
In-Reply-To: <20070713202258.14107.18196.stgit@lathund.dewire.com>

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

Hello,

On Fri, Jul 13, 2007 at 22:22:58 +0200, Robin Rosenberg wrote:
> +	else if (mode == DATE_ISO8601)
> +		sprintf(timebuf, "%04d-%02d-%02d %02d:%02d:%02d %+05d",
> +				tm->tm_year + 1900,
> +				tm->tm_mon + 1,
> +				tm->tm_mday,
> +				tm->tm_hour, tm->tm_min, tm->tm_sec,
> +				tz);

I apologise for nitpicking, but ISO 8601 (and RFC 3339) says separator between
date and time is 'T' and there is no separator between time and timezone. So
this should be

+		sprintf(timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%+05d",

for 100% conformance to the standard. RFC 3339 explicitely mentions using
space instead of 'T' as separator as allowed, but does not seem to mention
space before time zone. There may be applications that would stop at such
space and assume no timezone information.

Furthermore RFC 3339 seems to require colon in the timezone, so it would be:

+		sprintf(timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%+03d:%02d",
+				tm->tm_year + 1900,
+				tm->tm_mon + 1,
+				tm->tm_mday,
+				tm->tm_hour, tm->tm_min, tm->tm_sec,
+				tz / 100, abs(tz % 100));

ISO 8601 makes separators optional, so simple 4-digit timezone is OK.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2007-07-15 21:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-13 20:22 [PATCH] Support output ISO 8601 format dates Robin Rosenberg
2007-07-13 22:11 ` Junio C Hamano
2007-07-13 23:00   ` Robin Rosenberg
2007-07-14  6:42     ` [PATCH 1/2] Make show_rfc2822_date() just another date output format Junio C Hamano
2007-07-14  6:43     ` [PATCH 2/2] Wire new date formats to --date=<format> parser Junio C Hamano
2007-07-14  6:44       ` Jan-Benedict Glaw
2007-07-14  6:54         ` Junio C Hamano
2007-07-14 10:29       ` Robin Rosenberg
2007-07-14  6:49     ` [PATCH] Document new --date=<format> Junio C Hamano
2007-07-15 21:23 ` Jan Hudec [this message]
2007-07-15 22:14   ` [PATCH] Support output ISO 8601 format dates Junio C Hamano
2007-07-15 23:19   ` Robin Rosenberg
2007-07-15 23:57     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070715212359.GB18293@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=robin.rosenberg@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).