Request for simple date routines.

Jennifer H. Zemsky jhz at cunixa.cc.columbia.edu
Mon Apr 15 04:49:03 AEST 1991


In article <1991Apr9.234255.143 at mprgate.mpr.ca> stone at mars.mpr.ca (Darren Stone) writes:
>
>
>I really don't care at all about efficiency, but
>they must work absolutely reliably for +/- several
>hundred years (taking into account the leap-year
>rules).  Actually, what are the leap year rules?
>Something about evenly divisible by 4, except
>not by 100, except by 400?
>
can't help with the first two, but the rule of leap years is:
leap = (((year/4 is int) && !(year/100 is int)) || (year/400 is int))
this is why many electric calendars go from 1901 - 2099 ... it saves the
check of year/100.

good luck.


>- Darren -





More information about the Comp.lang.c mailing list