apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Collins-Sussman <suss...@newton.collab.net>
Subject Re: [patch] Time fixes for Win32
Date Thu, 01 Feb 2001 23:30:33 GMT
Cliff Woolley <cliffwoolley@yahoo.com> writes:

> --- cmpilato@collab.net wrote:
> > +/* Leap year is any year divisible by four, but not by 100 unless also
> > + * divisible by 400
> > + */
> > +#define IsLeapYear(y) ((!(y % 4)) ? (((!(y % 400)) && (y % 100)) ? 1 :
0) : 0)
> > +
> 
> If y is divisible evenly by 400, it's automatically divisible by 100... you don't need
to
> check both.  =-)

It's also divisible by 4, but that's not the point. :)

I think the the rule is:  every fourth year is a leap year, BUT, every
century is not;  BUT;  every fourth century *is* a leap year.   We've
got two levels of override here.

Mime
View raw message