summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-11-02 03:14:20 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-11-02 03:14:20 +0000
commit4a227f673a31f100f1965a49aa16a5b8073e822c (patch)
tree604e58e7c1cd020b7c0e4543d9466e93eb20047c
parent365194867575d4b7d429bb899b0340bd755d2761 (diff)
downloadrdiff-backup-4a227f673a31f100f1965a49aa16a5b8073e822c.tar.gz
Daylight savings fix
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@488 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG4
-rw-r--r--rdiff-backup/rdiff_backup/Time.py8
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