Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 1997 13:01:03 +0200 (MET DST)
From:      Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>
To:        wollman@khavrinen.lcs.mit.edu (Garrett Wollman)
Cc:        helbig@Informatik.BA-Stuttgart.DE, wollman@khavrinen.lcs.mit.edu, current@FreeBSD.ORG
Subject:   Re: Adding algorithms [Was: cvs commit: src/usr.bin/cksum crc32.c ...]
Message-ID:  <199709301101.NAA00699@rvc1.informatik.ba-stuttgart.de>
In-Reply-To: <199709292328.TAA13519@khavrinen.lcs.mit.edu> from Garrett Wollman at "Sep 29, 97 07:28:32 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> <<On Mon, 29 Sep 1997 23:47:32 +0200 (MET DST), Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE> said:
> 
> >> ISO 8601.  The strftime(3) function already provides this
> >> functionality, although there is unfortunately no direct
> >> iso8601weeknumber() function to give you the integer value directly.
> 
> > Unfortunately strftime(3)'s notion of week number only comes close
> > to DIN 1355:
> 
> > [ISO 9899 quotation deleted]

It seems to me that %V is not specified in ISO 9899. So our strftime(3)
is an extension to ISO C in this respect.  (The man page mentions
%s as the only extension)

> 
> UTSL.
> 
> 			case 'V':
> 				/*
> 				** From Arnold Robbins' strftime version 3.0:
> 				** "the week number of the year (the first
> 				** Monday as the first day of week 1) as a
> 				** decimal number (01-53).  The method for
> 				** determining the week number is as specified
> 				** by ISO 8601 (to wit: if the week containing
> 				** January 1 has four or more days in the new
> 				** year, then it is week 1, otherwise it is
> 				** week 53 of the previous year and the next
> 				** week is week 1)."
> 				** (ado, 5/24/93)
> 				*/
> 				/*
> 				** XXX--If January 1 falls on a Friday,
> 				** January 1-3 are part of week 53 of the
> 				** previous year.  By analogy, if January
> 				** 1 falls on a Thursday, are December 29-31
> 				** of the PREVIOUS year part of week 1???
> 				** (ado 5/24/93)

According to ISO 8601 the answer is "yes" and the current implementation
of strftime(3) is wrong in this respect. For Dec. 31st 1996 it replaces
%V by 53 instead of 01.

Another error occurs on Jan. 1st 1999: It should be week 53 but
%V is replaced by 52.

Any objections to fix it?
[...]
> I believe that more recent versions of this code also provide a
> conversion to match the ISO 8601 year-of-week, but our current version
> doesn't.  (I once made a stab at updating ours, but the locale code
> has changed too much.)

Where can one get that more recent versions?

Wolfgang



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709301101.NAA00699>