From 178527dab1e4d1214d35a8e67c02f699ed3ca7fe Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Fri, 5 Feb 2016 08:46:21 -0500 Subject: [PATCH] convert the backup increment time to the local timezone, fixes #700 Duplicity gives times in UTC. We were assuming times were in local time. --- CHANGELOG.md | 1 + management/backup.py | 5 ++--- management/templates/system-backup.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88552e5f..8183ba84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ In Development * Roundcube updated to version 1.1.4. * On multi-homed machines, Postfix now binds to the right network interface when sending outbound mail so that SPF checks on the receiving end will pass. +* Backup times were displayed with the wrong time zone. v0.16 (January 30, 2016) ------------------------ diff --git a/management/backup.py b/management/backup.py index 1612fcbc..1ecd625b 100755 --- a/management/backup.py +++ b/management/backup.py @@ -42,10 +42,10 @@ def backup_status(env): # Get duplicity collection status and parse for a list of backups. def parse_line(line): keys = line.strip().split() - date = dateutil.parser.parse(keys[1]) + date = dateutil.parser.parse(keys[1]).astimezone(dateutil.tz.tzlocal()) return { "date": keys[1], - "date_str": date.strftime("%x %X"), + "date_str": date.strftime("%x %X") + " " + now.tzname(), "date_delta": reldate(date, now, "the future?"), "full": keys[0] == "full", "size": 0, # collection-status doesn't give us the size @@ -120,7 +120,6 @@ def backup_status(env): bak["deleted_in"] = deleted_in return { - "tz": now.tzname(), "backups": backups, } diff --git a/management/templates/system-backup.html b/management/templates/system-backup.html index 1e538ecd..dc925916 100644 --- a/management/templates/system-backup.html +++ b/management/templates/system-backup.html @@ -142,7 +142,7 @@ function show_system_backup() { var b = r.backups[i]; var tr = $(''); if (b.full) tr.addClass("full-backup"); - tr.append( $('').text(b.date_str + " " + r.tz) ); + tr.append( $('').text(b.date_str) ); tr.append( $('').text(b.date_delta + " ago") ); tr.append( $('').text(b.full ? "full" : "increment") ); tr.append( $('').text( nice_size(b.size)) );