NOISE: Leap years (was Re: y2k problem *serious*)

Jeff Barber jeffb at issl.atl.hp.com
Tue Jul 29 09:37:12 PDT 1997



Ray Arachelian writes:

>             Also, the year 2000 isn't a leap year, but most
> PC's will think it is.

This is wrong.  2000 *is* a leap year.

A leap year is a year that is evenly divisible by four but not by
100 unless also divisible by 400.

For example, 1900, 2100 and 2200 aren't leap years, but 1600, 2000,
and 2400 are.

In C coder lingo:

Boolean
IsLeapYear(long year)
{
    if ((year % 4) == 0) {
	if ((year % 100) == 0) {
	    if ((year % 400) == 0)
		return True;
	    return False;
	}
	return True;
    }
    return False;
}


-- Jeff







More information about the cypherpunks-legacy mailing list