From owner-freebsd-questions Mon Oct 27 09:53:45 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA09763 for questions-outgoing; Mon, 27 Oct 1997 09:53:45 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from sumatra.americantv.com (sumatra.americantv.com [207.170.17.37]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id JAA09738; Mon, 27 Oct 1997 09:53:24 -0800 (PST) (envelope-from jlemon@americantv.com) Received: from right.PCS (right.PCS [148.105.10.31]) by sumatra.americantv.com (8.8.5/8.8.5) with ESMTP id LAA27228; Mon, 27 Oct 1997 11:53:18 -0600 (CST) Received: (from jlemon@localhost) by right.PCS (8.6.13/8.6.4) id LAA16722; Mon, 27 Oct 1997 11:52:46 -0600 Message-ID: <19971027115246.27753@right.PCS> Date: Mon, 27 Oct 1997 11:52:46 -0600 From: Jonathan Lemon To: Stephen Roome Cc: "Jonathan M. Bresler" , freebsd-questions@FreeBSD.ORG Subject: Re: 2000 Compliance / dates / time libs References: <199710271629.IAA00243@hub.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.61.1 In-Reply-To: ; from Stephen Roome on Feb 02, 2000 at 04:57:07AM +0000 Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Feb 02, 2000 at 04:57:07AM +0000, Stephen Roome wrote: > On Mon, 27 Oct 1997, Jonathan M. Bresler wrote: > > > Stephen Roome wrote: > > > > > > > > > I just set my clock to february 29 2000. Is this valid ? > > > > the algorithm, as i understand it is: > > > > if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) > > it is a leap year. > > > > this is only good back till the switch from julian to gregorian > > calendars. > > [You stole this from k&r didn't you =), well, that's the only place I > remember seeing this, especially in this format in C.] Actually, the exact same logic is used in FBSD; from libc/stdtime/tzfile.h: #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) Crosschecking, Oracle also says its a leap year: 1* select to_date('29-FEB-2000', 'DD-MON-YYYY') from dual --------- 29-FEB-00 1* select to_date('30-FEB-2000', 'DD-MON-YYYY') from dual ERROR: ORA-01839: date not valid for month specified > I've heard (I don't trust this source though!) that there maybe an ISO > committee for this. Some time/date code that I have refers to the ``ISO/R 2015-1971 and DIN 1355'' standards, so perhaps that may be what you mean? -- Jonathan