Article View: net.lang.c
Article #9323Re: Calendar Functions (simpler leap year calculation)
From: Daniel R. Levy
Date: Tue, 16 Sep 1986 23:38
Date: Tue, 16 Sep 1986 23:38
22 lines
1512 bytes
1512 bytes
In article <886@ihdev.UUCP>, pdg@ihdev.UUCP (P. D. Guthrie) writes:
>>Or if you want a simple cpp macro:
>>
>>#define isleapyear(year) ((year)%4)
>>
>>Bob Devine
>
>Or if you want a complex cpp macro
>to return the number of days in a year......
>
>#define num_day(x) ((x)%4 ? (x)%100 ? (x)%400 ? 366 : 355 : 356 : 355)
^^^ ^^^ ^^^
Huh?
--
------------------------------- Disclaimer: The views contained herein are
| dan levy | yvel nad | my own and are not at all those of my em-
| an engihacker @ | ployer or the administrator of any computer
| at&t computer systems division | upon which I may hack.
| skokie, illinois |
-------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
go for it! allegra,ulysses,vax135}!ttrdc!levy
Technical Details
Message-ID:
<1194@ttrdc.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!qantel!ihnp4!cuae2!ltuxa!ttrdc!levyReferences:
<206@cascade.STANFORD.EDU> <1229@loral.UUCP> <34@vianet.UUCP> <886@ihdev.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!qantel!ihnp4!cuae2!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: net.lang.c Subject: Re: Calendar Functions (simpler leap year calculation) Message-ID: <1194@ttrdc.UUCP> Date: Tue, 16-Sep-86 19:38:21 EDT Article-I.D.: ttrdc.1194 Posted: Tue Sep 16 19:38:21 1986 Date-Received: Wed, 17-Sep-86 08:16:49 EDT References: <206@cascade.STANFORD.EDU> <1229@loral.UUCP> <34@vianet.UUCP> <886@ihdev.UUCP> Distribution: net.lang.c Organization: AT&T, Computer Systems Division, Skokie, IL Lines: 22