Commit a56f43b0 authored by bescoto's avatar bescoto

Fix for daylight savings


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@487 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 546b899c
......@@ -10,6 +10,10 @@ was full (reported by Erik Forsberg).
Fixed remote quoting errors found by Daniel Drucker.
Fixed handling of daylight savings time. Earlier bug would cause some
files to be marked an hour later. Thanks to Troels Arvin and Farkas
Levente for bug report.
New in v0.13.3 (2003/10/14)
---------------------------
......
......@@ -35,6 +35,7 @@ _genstr_date_regexp1 = re.compile("^(?P<year>[0-9]{4})[-/]"
_genstr_date_regexp2 = re.compile("^(?P<month>[0-9]{1,2})[-/]"
"(?P<day>[0-9]{1,2})[-/](?P<year>[0-9]{4})$")
curtime = curtimestr = None
dst_in_effect = time.daylight and time.localtime()[8]
def setcurtime(curtime = None):
"""Sets the current time in curtime and curtimestr on all systems"""
......@@ -83,8 +84,7 @@ def stringtotime(timestring):
assert 0 <= minute <= 59
assert 0 <= second <= 61 # leap seconds
timetuple = (year, month, day, hour, minute, second, -1, -1, -1)
if time.daylight:
utc_in_secs = time.mktime(timetuple) - time.altzone
if dst_in_effect: utc_in_secs = time.mktime(timetuple) - time.altzone
else: utc_in_secs = time.mktime(timetuple) - time.timezone
return long(utc_in_secs) + tzdtoseconds(timestring[19:])
......@@ -144,8 +144,8 @@ def gettzd():
coincides with what localtime(), etc., use.
"""
if time.daylight: offset = -1 * time.altzone/60
else: offset = -1 * time.timezone/60
if dst_in_effect: offset = -time.altzone/60
else: offset = -time.timezone/60
if offset > 0: prefix = "+"
elif offset < 0: prefix = "-"
else: return "Z" # time is already in UTC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment