*BSD News Article 10674


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA462 ; Sun, 31 Jan 93 14:09:30 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!Germany.EU.net!incom!orfeo!hotb.RoBIN.de!alvman.RoBIN.de!not-for-mail
From: ah@alvman.RoBIN.de (Andreas Haakh)
Newsgroups: comp.unix.bsd
Subject: Re: [386bsd] New patch00071 is slightly wrong
Date: 1 Feb 1993 14:21:11 +0100
Lines: 17
Message-ID: <1kj847INNd5@alvman.RoBIN.de>
References: <bIQKePhq40@astral.msk.su>
NNTP-Posting-Host: localhost

"Andrew A. Chernov, Black Mage" <ache@astral.msk.su> writes:

>I just look into new patch00071 of clock.c and found small bug,
>it don't calculate leap year properly, produce error in 2000 year.

>! 	if (sec < 1970)
>! 		sec += 100;
>! 	leap = !(sec % 4); sec = ytos(sec); /* year    */

>Correct way to calculate leap year is:

>#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
                                                          ^^^^^^^^^^^^^^^^^
Year 2000 is a leap-year anyway! So the code is goot up to year 2099.
Who will be using 386bsd then??

Andreas