Puzzled with Time Server conversion problems?

Ivan Van Laningham ivanlan at callware.com
Wed Oct 6 11:34:54 EDT 1999


Hi All--

Bill Eldridge wrote:
> 
> Malcolm Tredinnick wrote:
> > def calc_leap_years(year):
> >         if (year > 1900):
> >                 return ((year - 1900) - 1)/4
> >         else:
> >                 return 0
> >
> > Of course, you can reduce it to a single line if you make the
> > assumption that the year will always be greater than 1900. And it
> > probably isn't wonderful programming practice to return 0 if say
> > year==1897 anyway (raise an exception?), but that is another issue.
> > This should be a fair bit faster than looping through the years.
> 
> Researching this:
> ------------------------------
> Years devisabl by 4 ARE leap years
> Except years devisable by 100 are NOT leap years
> Except years devisable by 400 which ARE leap years
> Except years devisable by 4000 which are NOT leap years!
> ------------------------------
> I thought there was a third rule in addition to %100 & %400 for
> millenia.
> 

[large bobbitt]

No.  There is no such rule.  One was first proposed by Sir John
Herschel, but never formally adopted.  The modern practice of inserting
leap seconds in relatively arbitrary fashion obviates the necessity of
such a millennial rule, at the wholesale expense of predictability and
calculability.  The 4000-year rule would correct the Gregorian calendar
satisfactorily within 1 day in 30,000 years.

The erstwhile Soviet Union had a rule in their version of the Gregorian
calendar, such that millennial years evenly divisible by 3000 and 9000
(or maybe it was 7000) were not leap.  This took their accuracy out to
about 70,000 years, as I recall.

See Zerubavel, Eviatar. _Hidden Rhythms: Schedules and Calendars in
Social Life_.  Chicago:  University of Chicago Press, 1981. 

<check-with-the-pope-if-you-don't-believe-me>-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan at callware.com
ivanlan at home.com
http://www.pauahtun.org
See also: 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
----------------------------------------------




More information about the Python-list mailing list