Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP
id AA90 ; Thu, 28 Jan 93 08:00:27 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!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: problems with date
Date: 25 Jan 1993 20:46:11 +0100
Lines: 26
Message-ID: <1k1g23INNor@alvman.RoBIN.de>
References: <1iu2jsINN518@fbi-news.Informatik.Uni-Dortmund.DE> <1993Jan14.064517.7201@st.simbirsk.su> <1j4gfuINNpme@hrd769.brooks.af.mil> <1jhlsdINNno7@life.ai.mit.edu>
NNTP-Posting-Host: localhost
mycroft@hal.gnu.ai.mit.edu (Charles Hannum) writes:
>I don't understand the point of the loop in clock.c. ...
I think the loop is no bad idea. It's easy to understand.
It works fine if you change the
if ( y % 4 ) ...
to
if ( (y+2) %4 ) ...
>+ #define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
Your macro `isleap` is correct but amusing.
The simple form
#define isleap(y) ((y%4)==0)
is good for the next 106 years.
Within this period clock.c will be rewritten several times for new
HW and/or OSes :-))
Andreas
--
Andreas Haakh -- ah@alvman.RoBIN.de