summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-11-02 02:40:57 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-11-02 02:40:57 +0000
commit8159184b733636dc277c0a2fa5f935556ea5a33e (patch)
treebba582e24944b7c39638dd77e058c6d1aa4d6a2f
parentbb9a1719a80b7e08202419f76b128ad041e5c1ab (diff)
downloadrdiff-backup-8159184b733636dc277c0a2fa5f935556ea5a33e.tar.gz
Fix for daylight savings
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@487 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 70104c9..a71478a 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -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)
---------------------------
diff --git a/rdiff-backup/rdiff_backup/Time.py b/rdiff-backup/rdiff_backup/Time.py
index e3a6173..553dcf7 100644
--- a/rdiff-backup/rdiff_backup/Time.py
+++ b/rdiff-backup/rdiff_backup/Time.py
@@ -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