From c012fccd22e9e6d812817382f1c759faf9ba512b Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 2 Nov 2018 20:36:15 +0100 Subject: [PATCH 1/2] Display local time for all commands --- cmd/restic/cmd_find.go | 2 +- cmd/restic/cmd_key.go | 2 +- cmd/restic/cmd_snapshots.go | 2 +- cmd/restic/format.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/restic/cmd_find.go b/cmd/restic/cmd_find.go index 5025e9d21..48b952f5d 100644 --- a/cmd/restic/cmd_find.go +++ b/cmd/restic/cmd_find.go @@ -213,7 +213,7 @@ func (s *statefulOutput) PrintObjectNormal(kind, id, nodepath, treeID string, sn } else { Printf(" ... path %s\n", nodepath) } - Printf(" ... in snapshot %s (%s)\n", sn.ID().Str(), sn.Time.Format(TimeFormat)) + Printf(" ... in snapshot %s (%s)\n", sn.ID().Str(), sn.Time.Local().Format(TimeFormat)) } func (s *statefulOutput) PrintObject(kind, id, nodepath, treeID string, sn *restic.Snapshot) { diff --git a/cmd/restic/cmd_key.go b/cmd/restic/cmd_key.go index 900b29d50..38ad77790 100644 --- a/cmd/restic/cmd_key.go +++ b/cmd/restic/cmd_key.go @@ -59,7 +59,7 @@ func listKeys(ctx context.Context, s *repository.Repository, gopts GlobalOptions ID: id.Str(), UserName: k.Username, HostName: k.Hostname, - Created: k.Created.Format(TimeFormat), + Created: k.Created.Local().Format(TimeFormat), } keys = append(keys, key) diff --git a/cmd/restic/cmd_snapshots.go b/cmd/restic/cmd_snapshots.go index 4655bb928..d9623b942 100644 --- a/cmd/restic/cmd_snapshots.go +++ b/cmd/restic/cmd_snapshots.go @@ -184,7 +184,7 @@ func PrintSnapshots(stdout io.Writer, list restic.Snapshots, reasons []restic.Ke for _, sn := range list { data := snapshot{ ID: sn.ID().Str(), - Timestamp: sn.Time.Format(TimeFormat), + Timestamp: sn.Time.Local().Format(TimeFormat), Hostname: sn.Hostname, Tags: sn.Tags, Paths: sn.Paths, diff --git a/cmd/restic/format.go b/cmd/restic/format.go index f915bc77e..d623371b8 100644 --- a/cmd/restic/format.go +++ b/cmd/restic/format.go @@ -90,6 +90,6 @@ func formatNode(path string, n *restic.Node, long bool) string { return fmt.Sprintf("%s %5d %5d %6d %s %s%s", mode|n.Mode, n.UID, n.GID, n.Size, - n.ModTime.Format(TimeFormat), path, + n.ModTime.Local().Format(TimeFormat), path, target) } From 20bcd281a303952be410f248f6d679dc783eb3e9 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 2 Nov 2018 20:40:52 +0100 Subject: [PATCH 2/2] Add entry to changelog --- changelog/unreleased/pull-2070 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/unreleased/pull-2070 diff --git a/changelog/unreleased/pull-2070 b/changelog/unreleased/pull-2070 new file mode 100644 index 000000000..30bd0fdd9 --- /dev/null +++ b/changelog/unreleased/pull-2070 @@ -0,0 +1,7 @@ +Enhancement: Make all commands display timestamps in local time + +Restic used to drop the timezone information from displayed timestamps, it now +converts timestamps to local time before printing them so the times can be +easily compared to. + +https://github.com/restic/restic/pull/2070