davis@hplabsb.UUCP (11/26/87)
roy=article <3021@phri.UUCP> roy@phri.UUCP (Roy Smith)
roy> Unix's "cal" command knows about the "if it's divisible by 4,
roy> except if it's divisible by 100 but not by 400" rule. Try "cal 2 2100"
roy> (or "cal 9 1752" for trivia buffs). I don't suppose those $2.99 LCD
roy> clock/calendars are so sophisticated, however.
Isn't there a 4000 year correction? So that the rule reads:
It's a leap year if its divisible by 4,
except if it's divisible by 100,
except if it's divisible by 400,
except if it's divisible by 4000.
For the more C minded: (since I've left the english ambiguous.)
leap = (yr%4)==0 && (yr%4000)!=0 && ( (yr%400)==0 || (yr%100)!=0);
cal(UTIL) doesn't seem to get it right in "cal 2 4000".
I'll have to write in a complaint ;-)
----------------------------------
Jim Davis (James W Davis)
Email: {any_of_the_biggies} !hplabs!davis
Arpa/Domain: davis@hplabs.hp.com
----------------------------------amos@taux01.UUCP (Amos Shapir) (11/27/87)
If I remember correctly, the 4000-year rule is valid only in the USSR and eastern Europe. The Greek Orthodox calendar does not have a 400-year rule, but instead defines as leap years those for which y/100 mod 9 == 2 or 6 so that 2000 and 2400 still count. See you on Feb 29 2800... -- Amos Shapir (My other cpu is a NS32532) National Semiconductor (Israel) 6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel Tel. +972 52 522261 amos%taux01@nsc.com (used to be amos%nsta@nsc.com) 34 48 E / 32 10 N