[Zope-Checkins] CVS: Zope/lib/python/DateTime - DateTime.py:1.79.6.5

seb seb@jamkit.com
Thu, 28 Nov 2002 09:35:28 -0500


Update of /cvs-repository/Zope/lib/python/DateTime
In directory cvs.zope.org:/tmp/cvs-serv18628/lib/python/DateTime

Modified Files:
      Tag: Zope-2_6-branch
	DateTime.py 
Log Message:
 - undo silly mistakes (DateTime regression; messing up CHANGES.txt)


=== Zope/lib/python/DateTime/DateTime.py 1.79.6.4 => 1.79.6.5 ===
--- Zope/lib/python/DateTime/DateTime.py:1.79.6.4	Thu Nov 28 07:11:47 2002
+++ Zope/lib/python/DateTime/DateTime.py	Thu Nov 28 09:35:27 2002
@@ -362,6 +362,10 @@
     return int(yr),int(mo),int(dy)
 
 def _tzoffset(tz, t):
+    """Returns the offset in seconds to GMT from a specific timezone (tz) at 
+    a specific time (t).  NB! The _tzoffset result is the same same sign as 
+    the time zone, i.e. GMT+2 has a 7200 second offset. This is the opposite 
+    sign of time.timezone which (confusingly) is -7200 for GMT+2."""
     try:
         return DateTime._tzinfo[tz].info(t)[0]
     except:
@@ -400,8 +404,10 @@
     return rval
 
 def _tzoffset2rfc822zone(seconds):
-    return "%+03d%02d" % divmod( (-seconds/60), 60) 
-
+    """Takes an offset, such as from _tzoffset(), and returns an rfc822 
+       compliant zone specification. Please note that the result of 
+       _tzoffset() is the negative of what time.localzone and time.altzone is."""
+    return "%+03d%02d" % divmod( (seconds/60), 60) 
 
 class DateTime:
     """DateTime objects represent instants in time and provide
@@ -1442,6 +1448,7 @@
         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,tzoffset)
+
 
     # New formats
     def fCommon(self):