mirror of
https://github.com/restic/restic.git
synced 2026-02-03 04:20:45 -05:00
Merge pull request #5588 from seqizz/g_timezoneshow
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
test / Linux Go 1.23.x (push) Has been cancelled
test / Linux Go 1.24.x (push) Has been cancelled
test / Linux (race) Go 1.25.x (push) Has been cancelled
test / Windows Go 1.25.x (push) Has been cancelled
test / macOS Go 1.25.x (push) Has been cancelled
test / Linux Go 1.25.x (push) Has been cancelled
test / Cross Compile for subset 0/3 (push) Has been cancelled
test / Cross Compile for subset 1/3 (push) Has been cancelled
test / Cross Compile for subset 2/3 (push) Has been cancelled
test / lint (push) Has been cancelled
test / docker (push) Has been cancelled
Create and publish a Docker image / provenance (push) Has been cancelled
test / Analyze results (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
test / Linux Go 1.23.x (push) Has been cancelled
test / Linux Go 1.24.x (push) Has been cancelled
test / Linux (race) Go 1.25.x (push) Has been cancelled
test / Windows Go 1.25.x (push) Has been cancelled
test / macOS Go 1.25.x (push) Has been cancelled
test / Linux Go 1.25.x (push) Has been cancelled
test / Cross Compile for subset 0/3 (push) Has been cancelled
test / Cross Compile for subset 1/3 (push) Has been cancelled
test / Cross Compile for subset 2/3 (push) Has been cancelled
test / lint (push) Has been cancelled
test / docker (push) Has been cancelled
Create and publish a Docker image / provenance (push) Has been cancelled
test / Analyze results (push) Has been cancelled
snapshots: Show timezone in non-compact output
This commit is contained in:
commit
6174c91042
2 changed files with 20 additions and 1 deletions
10
changelog/unreleased/pull-5588
Normal file
10
changelog/unreleased/pull-5588
Normal file
|
|
@ -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
|
||||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"io"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic/internal/data"
|
||||
"github.com/restic/restic/internal/global"
|
||||
|
|
@ -240,7 +241,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
|
||||
|
|
|
|||
Loading…
Reference in a new issue