Merge pull request 2095 from plumbeo/parse-location

Use local time for user-provided time of backup
This commit is contained in:
Alexander Neumann 2018-11-24 18:50:12 +01:00
commit 0de19cc87f
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,7 @@
Bugfix: consistently use local time for snapshots times
By default snapshots created with restic backup were set to local time,
but when the --time flag was used the provided timestamp was parsed as
UTC. With this change all snapshots times are set to local time.
https://github.com/restic/restic/pull/2095

View File

@ -377,7 +377,7 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
timeStamp := time.Now()
if opts.TimeStamp != "" {
timeStamp, err = time.Parse(TimeFormat, opts.TimeStamp)
timeStamp, err = time.ParseInLocation(TimeFormat, opts.TimeStamp, time.Local)
if err != nil {
return errors.Fatalf("error in time option: %v\n", err)
}