Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 3256:e5c9a084ffe3
util.strdate: assume local time when no timezone specified
author | Jose M. Prieto <jmprieto@gmx.net> |
---|---|
date | Tue, 03 Oct 2006 12:33:18 +0200 |
parents | e96d2956eb4a |
children | c9cd63a6fce9 |
line wrap: on
line diff
--- 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):