From owner-freebsd-current Sun Sep 28 06:58:08 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id GAA01991 for current-outgoing; Sun, 28 Sep 1997 06:58:08 -0700 (PDT) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id GAA01982 for ; Sun, 28 Sep 1997 06:57:49 -0700 (PDT) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.8.5/8.8.5) id JAA08605; Sun, 28 Sep 1997 09:57:42 -0400 (EDT) Date: Sun, 28 Sep 1997 09:57:42 -0400 (EDT) From: Garrett Wollman Message-Id: <199709281357.JAA08605@khavrinen.lcs.mit.edu> To: Wolfgang Helbig Cc: current@freebsd.org Subject: Re: Adding algorithms [Was: cvs commit: src/usr.bin/cksum crc32.c ...] In-Reply-To: <199709281226.OAA23108@rvc1.informatik.ba-stuttgart.de> References: <19970928080813.MB43888@uriah.heep.sax.de> <199709281226.OAA23108@rvc1.informatik.ba-stuttgart.de> Sender: owner-freebsd-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk < 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