Article View: comp.unix.bsd
Article #5696Re: problems with date
From: Andreas Haakh
Date: Mon, 25 Jan 1993 19:46
Date: Mon, 25 Jan 1993 19:46
26 lines
1145 bytes
1145 bytes
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
Technical Details
Message-ID:
<1k1g23INNor@alvman.RoBIN.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!ira.uka.de!Germany.EU.net!incom!orfeo!hotb.RoBIN.de!alvman.RoBIN.de!not-for-mailReferences:
<1iu2jsINN518@fbi-news.Informatik.Uni-Dortmund.DE> <1993Jan14.064517.7201@st.simbirsk.su> <1j4gfuINNpme@hrd769.brooks.af.mil> <1jhlsdINNno7@life.ai.mit.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!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