[Zope3-checkins] CVS: Zope3/lib/python/Zope/Misc - DateTimeParse.py:1.7

Marius Gedminas mgedmin@codeworks.lt
Mon, 18 Nov 2002 06:46:43 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Misc
In directory cvs.zope.org:/tmp/cvs-serv21631

Modified Files:
	DateTimeParse.py 
Log Message:
Fix a bug in timezone parsing (+xxxx was treated like -xxxx), add a unit
test for that.



=== Zope3/lib/python/Zope/Misc/DateTimeParse.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/Misc/DateTimeParse.py:1.6	Mon Nov 11 11:42:26 2002
+++ Zope3/lib/python/Zope/Misc/DateTimeParse.py	Mon Nov 18 06:46:43 2002
@@ -364,7 +364,11 @@
         return DateTimeParser._tzinfo[tz].info(t)[0]
     except:
         if numericTimeZoneMatch(tz) is not None:
-            return -int(tz[1:3])*3600-int(tz[3:5])*60
+            offset = int(tz[1:3])*3600+int(tz[3:5])*60
+            if tz[0] == '-':
+                return -offset
+            else:
+                return offset
         else:
             return 0 # XXX ??