mercurial/util.py
changeset 3256 e5c9a084ffe3
parent 3255 e96d2956eb4a
child 3257 c9cd63a6fce9
--- a/mercurial/util.py	Tue Oct 03 12:33:14 2006 +0200
+++ b/mercurial/util.py	Tue Oct 03 12:33:18 2006 +0200
@@ -909,9 +909,15 @@
         tz = int(tz)
         offset = - 3600 * (tz / 100) - 60 * (tz % 100)
     else:
-        date, offset = string, 0
-    localunixtime = int(calendar.timegm(time.strptime(date, format)))
-    unixtime = localunixtime + offset
+        date, offset = string, None
+    timetuple = time.strptime(date, format)
+    localunixtime = int(calendar.timegm(timetuple))
+    if offset is None:
+        # local timezone
+        unixtime = int(time.mktime(timetuple))
+        offset = unixtime - localunixtime
+    else:
+        unixtime = localunixtime + offset
     return unixtime, offset
 
 def parsedate(string, formats=None):