[Python-checkins] CVS: python/dist/src/Lib calendar.py,1.17,1.18

Guido van Rossum python-dev@python.org
Mon, 9 Oct 2000 05:42:07 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv2609

Modified Files:
	calendar.py 
Log Message:
Fixed leapdays().  From Patch #101841, by Denis S. Otkidach.


Index: calendar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** calendar.py	2000/08/30 14:01:28	1.17
--- calendar.py	2000/10/09 12:42:04	1.18
***************
*** 55,60 ****
  def leapdays(y1, y2):
      """Return number of leap years in range [y1, y2).
!        Assume y1 <= y2 and no funny (non-leap century) years."""
!     return (y2+3)/4 - (y1+3)/4
  
  def weekday(year, month, day):
--- 55,62 ----
  def leapdays(y1, y2):
      """Return number of leap years in range [y1, y2).
!        Assume y1 <= y2."""
!     y1 -= 1
!     y2 -= 1
!     return (y2/4 - y1/4) - (y2/100 - y1/100) + (y2/400 - y1/400)
  
  def weekday(year, month, day):