[Zope-Checkins] CVS: Zope/lib/python/DateTime - DateTime.py:1.79.4.1
Chris McDonough
chrism@zope.com
Sat, 26 Oct 2002 15:52:09 -0400
Update of /cvs-repository/Zope/lib/python/DateTime
In directory cvs.zope.org:/tmp/cvs-serv31373/lib/python/DateTime
Modified Files:
Tag: chrism-install-branch
DateTime.py
Log Message:
Merge with HEAD. Again, sorry for the spew (what's left of it... someone seems to have filtered some of this branch's checkins out).
=== Zope/lib/python/DateTime/DateTime.py 1.79 => 1.79.4.1 ===
--- Zope/lib/python/DateTime/DateTime.py:1.79 Wed Aug 14 17:33:49 2002
+++ Zope/lib/python/DateTime/DateTime.py Sat Oct 26 15:51:38 2002
@@ -17,8 +17,7 @@
import re,sys, os, math, DateTimeZone
from time import time, gmtime, localtime, asctime
-from time import timezone, strftime
-from time import daylight, timezone, altzone
+from time import daylight, timezone, altzone, strftime
from types import InstanceType,IntType,FloatType,StringType,UnicodeType
try: from time import tzname
except: tzname=('UNKNOWN','UNKNOWN')
@@ -400,6 +399,9 @@
rval = localtime(t_int)
return rval
+def _tzoffset2rfc822zone(seconds):
+ return "%+03d%02d" % divmod( (-seconds/60), 60)
+
class DateTime:
"""DateTime objects represent instants in time and provide
@@ -1435,9 +1437,16 @@
def rfc822(self):
"""Return the date in RFC 822 format"""
+ if self._tz == self._localzone0: #Use local standard time
+ tzoffset = _tzoffset2rfc822zone(timezone)
+ elif self._tz == self._localzone1: # Use local daylight saving time
+ tzoffset = _tzoffset2rfc822zone(altzone)
+ else:
+ tzoffset = '-0000' # unknown time zone offset
+
return '%s, %2.2d %s %d %2.2d:%2.2d:%2.2d %s' % (
self._aday,self._day,self._amon,self._year,
- self._hour,self._minute,self._nearsec,self._tz)
+ self._hour,self._minute,self._nearsec,tzoffset)
# New formats