[Python-checkins] CVS: python/dist/src/Lib/email Utils.py,1.7,1.8

Barry Warsaw bwarsaw@users.sourceforge.net
2001年11月19日 10:36:46 -0800


Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv8196/Lib/email
Modified Files:
	Utils.py 
Log Message:
formatdate(): Jason Mastaler correctly points out that divmod with a
negative modulus won't return the right values. So always do positive
modulus on an absolute value and twiddle the sign as appropriate after
the fact.
Index: Utils.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Utils.py	2001年11月19日 16:28:07	1.7
--- Utils.py	2001年11月19日 18:36:43	1.8
***************
*** 131,136 ****
 else:
 offset = time.timezone
! hours, minutes = divmod(offset, -3600)
! zone = '%+03d%02d' % (hours, minutes / -60)
 else:
 now = time.gmtime(timeval)
--- 131,142 ----
 else:
 offset = time.timezone
! hours, minutes = divmod(abs(offset), 3600)
! # Remember offset is in seconds west of UTC, but the timezone is in
! # minutes east of UTC, so the signs differ.
! if offset > 0:
! sign = '-'
! else:
! sign = '+'
! zone = '%s%02d%02d' % (sign, hours, minutes / 60)
 else:
 now = time.gmtime(timeval)

AltStyle によって変換されたページ (->オリジナル) /