Commit 8b398907 authored by bescoto's avatar bescoto

Daylight savings fix


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@488 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent a56f43b0
...@@ -20,6 +20,10 @@ Fixed rather important quoting problem: quoting directives like ...@@ -20,6 +20,10 @@ Fixed rather important quoting problem: quoting directives like
remotely! I'm surprised no one noticed this. Are none of you using remotely! I'm surprised no one noticed this. Are none of you using
--windows-mode or similar? --windows-mode or similar?
Fixed handling of (lack 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.12.5 (2003/09/27) New in v0.12.5 (2003/09/27)
--------------------------- ---------------------------
......
...@@ -34,6 +34,7 @@ _genstr_date_regexp1 = re.compile("^(?P<year>[0-9]{4})[-/]" ...@@ -34,6 +34,7 @@ _genstr_date_regexp1 = re.compile("^(?P<year>[0-9]{4})[-/]"
_genstr_date_regexp2 = re.compile("^(?P<month>[0-9]{1,2})[-/]" _genstr_date_regexp2 = re.compile("^(?P<month>[0-9]{1,2})[-/]"
"(?P<day>[0-9]{1,2})[-/](?P<year>[0-9]{4})$") "(?P<day>[0-9]{1,2})[-/](?P<year>[0-9]{4})$")
curtime = curtimestr = None curtime = curtimestr = None
dst_in_effect = time.daylight and time.localtime()[8]
def setcurtime(curtime = None): def setcurtime(curtime = None):
"""Sets the current time in curtime and curtimestr on all systems""" """Sets the current time in curtime and curtimestr on all systems"""
...@@ -82,8 +83,7 @@ def stringtotime(timestring): ...@@ -82,8 +83,7 @@ def stringtotime(timestring):
assert 0 <= minute <= 59 assert 0 <= minute <= 59
assert 0 <= second <= 61 # leap seconds assert 0 <= second <= 61 # leap seconds
timetuple = (year, month, day, hour, minute, second, -1, -1, -1) timetuple = (year, month, day, hour, minute, second, -1, -1, -1)
if time.daylight: if dst_in_effect: utc_in_secs = time.mktime(timetuple) - time.altzone
utc_in_secs = time.mktime(timetuple) - time.altzone
else: utc_in_secs = time.mktime(timetuple) - time.timezone else: utc_in_secs = time.mktime(timetuple) - time.timezone
return long(utc_in_secs) + tzdtoseconds(timestring[19:]) return long(utc_in_secs) + tzdtoseconds(timestring[19:])
...@@ -143,8 +143,8 @@ def gettzd(): ...@@ -143,8 +143,8 @@ def gettzd():
coincides with what localtime(), etc., use. coincides with what localtime(), etc., use.
""" """
if time.daylight: offset = -1 * time.altzone/60 if dst_in_effect: offset = -time.altzone/60
else: offset = -1 * time.timezone/60 else: offset = -time.timezone/60
if offset > 0: prefix = "+" if offset > 0: prefix = "+"
elif offset < 0: prefix = "-" elif offset < 0: prefix = "-"
else: return "Z" # time is already in UTC 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