diff --git a/changelog/unreleased/pull-5588 b/changelog/unreleased/pull-5588 new file mode 100644 index 000000000..dd3ab25e2 --- /dev/null +++ b/changelog/unreleased/pull-5588 @@ -0,0 +1,10 @@ +Enhancement: Display timezone information in snapshots output + +The `snapshots` command now displays which timezone is being used to show +timestamps. Since snapshots can be created in different timezones but are +always displayed in the local timezone, a footer line is now shown indicating +the timezone used for display (e.g., "Timestamps shown in CET timezone"). +This helps prevent confusion when comparing snapshots in a multi-user +environment. + +https://github.com/restic/restic/pull/5588 diff --git a/cmd/restic/cmd_snapshots.go b/cmd/restic/cmd_snapshots.go index f37481b29..33ffb7527 100644 --- a/cmd/restic/cmd_snapshots.go +++ b/cmd/restic/cmd_snapshots.go @@ -7,6 +7,7 @@ import ( "io" "sort" "strings" + "time" "github.com/restic/restic/internal/data" "github.com/restic/restic/internal/global" @@ -265,7 +266,15 @@ func PrintSnapshots(stdout io.Writer, list data.Snapshots, reasons []data.KeepRe tab.AddRow(data) } - tab.AddFooter(fmt.Sprintf("%d snapshots", len(list))) + // Add timezone information to prevent confusion: + // Each snapshot can be registered in different timezones, + // but we display them all in local timezone on this output. + footer := fmt.Sprintf("%d snapshots", len(list)) + zoneName, _ := time.Now().Local().Zone() + if zoneName != "" { + footer = fmt.Sprintf("Timestamps shown in %s timezone\n%s", zoneName, footer) + } + tab.AddFooter(footer) if multiline { // print an additional blank line between snapshots