Skip to content

Commit

Permalink
convert the backup increment time to the local timezone, fixes #700
Browse files Browse the repository at this point in the history
Duplicity gives times in UTC. We were assuming times were in local time.
  • Loading branch information
JoshData committed Feb 5, 2016
1 parent f5c376d commit 178527d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------------
Expand Down
5 changes: 2 additions & 3 deletions management/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def reldate(date, ref, clip):
# 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
Expand Down Expand Up @@ -120,7 +120,6 @@ def parse_line(line):
bak["deleted_in"] = deleted_in

return {
"tz": now.tzname(),
"backups": backups,
}

Expand Down
2 changes: 1 addition & 1 deletion management/templates/system-backup.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h3>Available Backups</h3>
var b = r.backups[i];
var tr = $('<tr/>');
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.full ? "full" : "increment") );
tr.append( $('<td style="text-align: right"/>').text( nice_size(b.size)) );
Expand Down

1 comment on commit 178527d

@kurt89523
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Please sign in to comment.