convert the backup increment time to the local timezone, fixes #700

Duplicity gives times in UTC. We were assuming times were in local time.
This commit is contained in:
Joshua Tauberer 2016-02-05 08:46:21 -05:00
parent f5c376dca8
commit 178527dab1
3 changed files with 4 additions and 4 deletions

View File

@ -6,6 +6,7 @@ In Development
* Roundcube updated to version 1.1.4. * 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. * 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) v0.16 (January 30, 2016)
------------------------ ------------------------

View File

@ -42,10 +42,10 @@ def backup_status(env):
# Get duplicity collection status and parse for a list of backups. # Get duplicity collection status and parse for a list of backups.
def parse_line(line): def parse_line(line):
keys = line.strip().split() keys = line.strip().split()
date = dateutil.parser.parse(keys[1]) date = dateutil.parser.parse(keys[1]).astimezone(dateutil.tz.tzlocal())
return { return {
"date": keys[1], "date": keys[1],
"date_str": date.strftime("%x %X"), "date_str": date.strftime("%x %X") + " " + now.tzname(),
"date_delta": reldate(date, now, "the future?"), "date_delta": reldate(date, now, "the future?"),
"full": keys[0] == "full", "full": keys[0] == "full",
"size": 0, # collection-status doesn't give us the size "size": 0, # collection-status doesn't give us the size
@ -120,7 +120,6 @@ def backup_status(env):
bak["deleted_in"] = deleted_in bak["deleted_in"] = deleted_in
return { return {
"tz": now.tzname(),
"backups": backups, "backups": backups,
} }

View File

@ -142,7 +142,7 @@ function show_system_backup() {
var b = r.backups[i]; var b = r.backups[i];
var tr = $('<tr/>'); var tr = $('<tr/>');
if (b.full) tr.addClass("full-backup"); if (b.full) tr.addClass("full-backup");
tr.append( $('<td/>').text(b.date_str + " " + r.tz) ); tr.append( $('<td/>').text(b.date_str) );
tr.append( $('<td/>').text(b.date_delta + " ago") ); tr.append( $('<td/>').text(b.date_delta + " ago") );
tr.append( $('<td/>').text(b.full ? "full" : "increment") ); tr.append( $('<td/>').text(b.full ? "full" : "increment") );
tr.append( $('<td style="text-align: right"/>').text( nice_size(b.size)) ); tr.append( $('<td style="text-align: right"/>').text( nice_size(b.size)) );