git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Support output ISO 8601 format dates

From
JHJan Hudec <bulb@ucw.cz>
Date
Jul 15, 2007, 21:23 UTC
Message-ID
<20070715212359.GB18293@efreet.light.src>
In-Reply-To
<20070713202258.14107.18196.stgit@lathund.dewire.com>
Hello,
On Fri, Jul 13, 2007 at 22:22:58 +0200, Robin Rosenberg wrote:
Show 7 quoted lines
> +	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>
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 13 in “Support output ISO 8601 format dates”
  1. Support output ISO 8601 format datesRobin Rosenberg, Jul 13, 2007
  2. Junio C HamanoJul 13, 2007
  3. Support output ISO 8601 format datesRobin Rosenberg, Jul 13, 2007
  4. 1/2 Make show_rfc2822_date() just another date output format.Junio C Hamano, Jul 14, 2007
  5. 2/2 Wire new date formats to --date=<format> parser.Junio C Hamano, Jul 14, 2007
  6. Jan-Benedict GlawJul 14, 2007
  7. Junio C HamanoJul 14, 2007
  8. Robin RosenbergJul 14, 2007
  9. Document new --date=<format>Junio C Hamano, Jul 14, 2007
  10. Jan HudecJul 15, 2007
  11. Junio C HamanoJul 15, 2007
  12. Robin RosenbergJul 15, 2007
  13. Linus TorvaldsJul 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.