Re: Date/Time in ISO/IEC CD 14652

From: Markus Kuhn (mskuhn@cip.informatik.uni-erlangen.de)
Date: Sun Sep 07 1997 - 06:16:11 EDT


Keld J|rn Simonsen wrote:

> [...] ISO CD 14652

I just downloaded this draft standard from

  http://www.dkuug.dk/JTC1/SC22/WG20/prot

Minor comment:

The date field descriptors in 4.1.5.1 seem to be somewhat incomplete,
and this should in my opinion be revised in cooperation with the ISO C
folks. Below is an excerpt from a mail that I sent already to some ISO
C people like Clive D.W. Feather <clive@demon.net>. A very similar
comment from Paul Eggert (a widely respected POSIX time handling
algorithm implementor) can be found in the archive of the tz mailing
list <ftp://elsie.nci.nih.gov/pub/tzarchive.gz>.

   - %V alone is not sufficient to be able to use the ISO week numbering
     system. Each week is associated with a year, the year in which the
     majority of the days of this week fall, and this is not necessarily
     the year in which all days of the weeks fall. For instance: The
     week 1999-W52 goes from 1999-12-27 to 2000-01-02, in other
     words, the day 2000-01-02 has a week notation of the
     form 1999-W52-7. There should be another format descriptor for
     the year to which the current ISO week belongs, preferably both
     in 4-digit (%G) and 2-digit (%g) form.
     If you implement an algorithm for %V, you'll get the value of %G
     anyway as a by-product very easily, and therefore it should be
     made available to the strftime() user.

   - Existing practice: The Olson tzcode package <ftp://elsie.nci.nih.gov/pub/>
     contains a widely used strftime() implementation that supports already:

       %u ISO 8601 week day number (1 = Monday, 7=Sunday)
       %V ISO 8601 week number (01-53)
       %G ISO 8601 year of current week, 4-digits
       %g ISO 8601 year of current week, 2-digits

     Unless there is a good rationale for the characters suggested
     by N733, I would suggest to stick with %u instead of %f for the
     weekday number, and I hope that you will add %G and %g as used
     in the Olson package and Arnold Robbins' strftime version 3.0.

     Therefore, if I evaluate on 1977-01-02 the string %G-W%V-%u, I should
     get 1976-W53-7, and on 1975-12-29 I should get 1976-W01-1.

Markus



This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:36 EDT