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

Lennart Regebro lennart@torped.se
Thu, 16 Jan 2003 11:42:10 -0500


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

Modified Files:
	DateTime.py 
Log Message:
Merge with HEAD.

#740: _tzoffset handled positive numerical offsets incorrectly. This has been fixed. A large set of tests for different cases has been added, and for the purpose of those tests DateTime has a new feature: A tzoffset() method.

=== Zope/lib/python/DateTime/DateTime.py 1.83 => 1.84 ===
--- Zope/lib/python/DateTime/DateTime.py:1.83	Fri Dec 13 07:33:57 2002
+++ Zope/lib/python/DateTime/DateTime.py	Thu Jan 16 11:41:38 2003
@@ -370,7 +370,7 @@
         return DateTime._tzinfo[tz].info(t)[0]
     except:
         if numericTimeZoneMatch(tz) is not None:
-            return -int(tz[1:3])*3600-int(tz[3:5])*60
+            return int(tz[0:3])*3600+int(tz[0]+tz[3:5])*60
         else:
             return 0 # ??
 
@@ -1293,6 +1293,10 @@
     def timezone(self):
         """Return the timezone in which the object is represented."""
         return self._tz
+
+    def tzoffset(self):
+        """Return the timezone offset for the objects timezone."""
+        return _tzoffset(self._tz, self._t)
 
     def year(self):
         """Return the calendar year of the object"""