[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parse-datetime.y & ISO8601 timestamps
From: |
Pádraig Brady |
Subject: |
Re: parse-datetime.y & ISO8601 timestamps |
Date: |
Wed, 27 Apr 2011 23:27:59 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
On 27/04/11 16:47, J.T. Conklin wrote:
> First some background.
>
> The continuous integration build framework I maintain at work uses
> timestamp files for "last_build", "last_success", etc. The contents
> of each file is the timestamp in ISO 8601 format (the inode mtime is
> set to the same value, but thats besides the point).
>
> I used this format thinking that the 'T' separator between date and
> time would be more resistant to errors (shell quoting, etc.) than a
> format that used spaces.
>
> But someone reported that coreutils' date's -d option could not parse
> this format. Fortunately, date -r could be used; but this challenges
> my idea that the ISO format is more useful.
>
> I've done some tweaks to parse-datetime.y as shown. Since 'T' now can
> be either a millitary-style single character timezone and a separator,
> I've special cased it as a token in the lexer. With the changes, the
> function can parse the ISO 8601 / RFC 3339 YYYY-MM-DDTHH:MM:DD+MMSS
> format (but not other valid ISO 8601 formats that omit -'s and :'s).
> This adds another grammar conflict, but the parse-getdate test suite
> still executes correctly.
>
> I'm interested in comments on both the idea of supporting such time
> formats, and whether there is a better implementation.
See also the related request to support this as an output format from `date`
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6453
cheers,
Pádraig.