Hello Paul,
At 2000-04-18 18:47, Paul Eggert wrote:
> > It would seem the use
> > of "/" is a "left-over" from using the American date format, which is
> > MM/DD/YY.
>
>No, it's actually a leftover from RCS, which originally used the date
>format YY/MM/DD. This is not the American date format: it was
>designed by W. Tichy (a German :-) in the early 1980s and I believe it
>predates ISO 8601. As RCS maintainer I extended the format to
>YYYY/MM/DD in the early 1990s. I stuck with the "/" for backward
>compatibility, as some RCS date-parsing software back then didn't
>allow "-".
>
>I wouldn't object if the date format were changed to ISO 8601 now,
>though of course there should be an option to leave it the way it is.
Thanx for your answer.
I've not studied the CVS and RCS sources as I'm sure more qualified
programmers than me are able to see the consequences of such a change
(such as to rcs (does cvs still depend on rcs?) and older CVS repositories).
I have tried this with the Unix `date' command (Gnu/sh-utils' date supports
a --iso-8601 flag), because instead of just commenting I wanted to be really
helpful and suggest a c-diff to the author, but i quickly got lost in
strftime() and some other libraries and the solution was not directly obvious
to me.
A few obvious options do come to mind of course, which would have the
benefit of not breaking older code and repositories:
o Make it a compile-only option (settable as eg. ./configure --iso-8601)
This way the user explicitly decides to do so, so supposedly knows what
he or she is doing!
o Putting it as an option in the CVSROOT/config file, eg.
DateFormat=ISO_8601 (CCYY-MM-DD hh:mm:ss UTC)
[ but see my "****> most flexible/standards-conformant solution" below ]
By the way, strictly speaking ISO 8601 has several formats (the 'basic'
and 'extended'), and formally YYMMDD (basic format) and YY-MM-DD are
valid ISO 8601 dates as well---however the Y2K problem should have taught us
that it is better to use the (also 8601 valid) CCYYMMDD (basic) or the more
readable CCYY-MM-DD (extended) format.
Even more strictly... if you also use the time (and optionally the difference
between local time and 'Zulu time' (UTC - Coordinated Universal Time)),
the official ISO 8601 notation (extended format) is (note the 'T')
(note '+/-' is 1 character, the plusminus character):
CCYY-MM-DDThh:mm:ss (eg. 2000-02-29T14:42:42)
CCYY-MM-DDThh:mm:ssZ (eg. 2000-02-29T14:42:42Z)
CCYY-MM-DDThh:mm:ss+/-hh:mm (eg. 2000-02-29T14:42:42+02:00) (Holland)
(eg. 2000-02-29T14:42:42-07:00) (New York?)
Personally, I don't like the 'T' separator (although it is very understandable
with the standard does not use a space ' '), so you could say:
DateFormat=ISO_8601_extended
ISO_Date_Separator="T" (default?!)
ISO_Date_Separator=" " (a space)
****> most flexible/standards-conformant solution ?
Perhaps the best and most flexible way to implement a date format is
to use strftime() kinda syntax, like whatis done in ProFTPD's LogFormat
(eg. LogFormat iso "[%{%Y-%m-%d %H:%M:%S}t], that I use).
Again, this could perhaps be a
DateFormat="..."
option in CVSROOT/config. CVS would read this format string and feed
it to strftime().
However, and strangely enough, the (ISO) Posix definition for strftime()
(and date for that matter) do not fully implement ISO 8601 as is well
described by Markus Kuhn is his proposed new <time.h> for ISO C 200X:
http://www.cl.cam.ac.uk/~mgk25/c-time/
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
Eg., strftime() lacks the timezone formats hhmm (basic format) and
hh:mm (extended format). Gnu's strftime() has an extension to the
Posix standard (which only has the '%Z' which gives a string: CET, PDT etc.)
namely '%z', however this gives hhmm (basic format) only (rfc 822 style).
(Gnu's date --iso-8601=seconds -u' --> 2000-04-19T11:04:51Z
does conform to 8601 and has UTC time, which is used by CVS)
Markus proposes a '%:z' which gives hh:mm (extended format).
When implemented in strftime(), this would make things possible like:
o Default `date' format:
DateFormat="%a %b %e %H:%M:%S %Z %Y"
Example: Wed Apr 19 12:38:48 CEST 2000
This is also the default for ISO Posix's `date', as demonstrated by:
date '+%a %b %e %H:%M:%S %Z %Y' --> Wed Apr 19 12:38:48 CEST 2000
o CVS/RCS's current format (gettimeofday() gets UTC time):
DateFormat="%Y/%m/%d %H:%M:%S"
Example: 2000/04/19 11:09:11
Eg, use Gnu's date -u '+%Y/%m/%d %H:%M:%S' --> 2000/04/19 11:09:11).
o Strict ISO 8601 extended format (local time, with time-diff. spec.)
(note '%:z' and not '%z'):
DateFormat="%Y-%m-%dT%H:%M:%S%:z"
Example: 2000-04-19T13:00:46+02:00
o Strict ISO 8601 extended format (UTC)
(note '%:z' and not '%z', gettimeofday() gets UTC):
DateFormat="%Y-%m-%dT%H:%M:%SZ"
Example: 2000-04-19T11:00:46Z
o ISO 8601 extended format (more readable, local time, with time-diff. spec.)
(well, strictly not iso8601, the 'T' is replaced with a space and a space
is inserted between time and timezone):
DateFormat="%Y-%m-%d %H:%M:%S %:z"
Example: 2000-04-19 13:00:46 +02:00
o ISO 8601 extended format (more readable, UTC) <--- PREFERRED FORM ?!
(well, strictly not iso8601, the 'T' is replaced with a space and a space
is inserted between time and timezone; gettimeofday() gets UTC):
DateFormat="%Y-%m-%d %H:%M:%S UTC"
Example: 2000-04-19 11:00:46 UTC
Just as an aside, I use this `isodate' alias under Linux:
alias isodate="date '+%Y-%m-%d %H:%M:%S %z'|sed -e 's/00$/:00/' -e 's/30$/:30/'"
which returns: 2000-04-19 13:00:46 +02:00
(with sed fixing Gnu's %z (hhmm), to hh:mm).
Imho this strftime() kinda form would be really cool and flexible, so
everybody should be able to express their preferred form (if not, the
default would be CVS/RCS's old and backward compatible form) with that
and could be happy with that.
I hope this all may be helpful in some way and not too much confusing :-)
Kind regards,
Eric Maryniak
PS: Paul, I will send you separately the latest (that I know of)
ISO 8601 proposal in PDF (I'm not sure if [EMAIL PROTECTED] is
a list).
--
Eric Maryniak <[EMAIL PROTECTED]>
Home page: http://pobox.com/~e.maryniak/
University of Amsterdam, Department of Psychology.
Tel/Fax: +31 20 5256853/6391656. Internet: http://www.neuromod.org/
Your mouse has moved. Windows NT must be restarted for the change
to take effect. Reboot now? [ OK ]