Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Sep 1997 09:57:42 -0400 (EDT)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>
Cc:        current@freebsd.org
Subject:   Re: Adding algorithms [Was: cvs commit: src/usr.bin/cksum crc32.c ...]
Message-ID:  <199709281357.JAA08605@khavrinen.lcs.mit.edu>
In-Reply-To: <199709281226.OAA23108@rvc1.informatik.ba-stuttgart.de>
References:  <19970928080813.MB43888@uriah.heep.sax.de> <199709281226.OAA23108@rvc1.informatik.ba-stuttgart.de>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Sun, 28 Sep 1997 14:26:14 +0200 (MET DST), Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE> said:

>   I'd like to supply two or three fundamental calendar calculations:
>   o Computes from a date the number of days since March 1st 1600

Would be better to use astronomical Julian Day Numbers.  Remember,
Great Britain and her colonies did not adopt the Gregorian calendar
until August of 1752.  (Your mission, should you choose to accept
it... create a database of ``switch dates'' and modify cal(1) to use
it.)

>   o Computes the Number of Week from a given date.
>     According to DIN 1355 : The first week of year y is the first week
>     that includes at least four days in year y. A week starts with
>     Monday. I don't know about international standards so it might be
>     useful for Germany only.

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.
This is of course not in the C standard because nobody in the US could
care less about counting weeks (well, except for accountants at those
companies whose quarter is exactly 13 weeks long and ends on a
Friday).

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick



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