diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-08-15 15:50:39 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-08-15 15:50:39 +0200 |
commit | 10cb448218bdbfeaf692063758e09b70fdc837ec (patch) | |
tree | 283cff0a3697d0fc32041305a61f0cd39062f5a2 | |
parent | f98e09d9848762860ce7eeb0b993242d2ed2949b (diff) | |
download | bin-10cb448218bdbfeaf692063758e09b70fdc837ec.tar.gz bin-10cb448218bdbfeaf692063758e09b70fdc837ec.tar.xz |
borg-restore.pl: Fix incorrect timezone
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | borg-restore.pl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/borg-restore.pl b/borg-restore.pl index fa0b0c2..d15f217 100755 --- a/borg-restore.pl +++ b/borg-restore.pl @@ -176,8 +176,7 @@ sub user_select_archive { } for my $archive (@$archives) { - my $dt = DateTime->from_epoch(epoch => $archive->{modification_time}); - printf "\e[0;33m%3d: \e[1;33m%s\e[0m %s\n", $counter++, $dt->strftime("%a. %F %H:%M:%S"), $archive->{archive}; + printf "\e[0;33m%3d: \e[1;33m%s\e[0m %s\n", $counter++, format_timestamp($archive->{modification_time}), $archive->{archive}; } printf "\e[0;34m%s: \e[0m", "Enter ID to restore (Enter to skip)"; @@ -215,9 +214,9 @@ sub select_archive_timespec { sub format_timestamp { my $timestamp = shift; - # FIXME this outputs UTC. fix it to output local time - my $dt = DateTime->from_epoch(epoch => $timestamp); - return $dt->strftime("%a. %F %H:%M:%S"); + state $timezone = DateTime::TimeZone->new( name => 'local' ); + my $dt = DateTime->from_epoch(epoch => $timestamp, time_zone => $timezone); + return $dt->strftime("%a. %F %H:%M:%S %z"); } sub timespec_to_seconds { |