Date: Mon, 27 Oct 1997 11:52:46 -0600 From: Jonathan Lemon <jlemon@americantv.com> To: Stephen Roome <steve@visint.co.uk> Cc: "Jonathan M. Bresler" <jmb@FreeBSD.ORG>, freebsd-questions@FreeBSD.ORG Subject: Re: 2000 Compliance / dates / time libs Message-ID: <19971027115246.27753@right.PCS> In-Reply-To: <Pine.BSF.3.95.1000229045221.14383D-100000@dylan.visint.co.uk>; from Stephen Roome on Feb 02, 2000 at 04:57:07AM %2B0000 References: <199710271629.IAA00243@hub.freebsd.org> <Pine.BSF.3.95.1000229045221.14383D-100000@dylan.visint.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971027115246.27753>