diff options
-rw-r--r-- | rdiff-backup/CHANGELOG | 4 | ||||
-rw-r--r-- | rdiff-backup/rdiff_backup/Time.py | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index ae21931..dc2b43d 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -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 --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) --------------------------- diff --git a/rdiff-backup/rdiff_backup/Time.py b/rdiff-backup/rdiff_backup/Time.py index 289df0a..3fa872b 100644 --- a/rdiff-backup/rdiff_backup/Time.py +++ b/rdiff-backup/rdiff_backup/Time.py @@ -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})[-/]" "(?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""" @@ -82,8 +83,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:]) @@ -143,8 +143,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 |