2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 23:06:32 +00:00

backup: Parse timestamp earlier

This commit is contained in:
Alexander Neumann 2018-06-01 18:41:44 +02:00
parent 419acad3c3
commit 42ebb0a0a6

View File

@ -336,6 +336,14 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
return err return err
} }
timeStamp := time.Now()
if opts.TimeStamp != "" {
timeStamp, err = time.Parse(TimeFormat, opts.TimeStamp)
if err != nil {
return errors.Fatalf("error in time option: %v\n", err)
}
}
var t tomb.Tomb var t tomb.Tomb
p := ui.NewBackup(term, gopts.verbosity) p := ui.NewBackup(term, gopts.verbosity)
@ -402,14 +410,6 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
return true return true
} }
timeStamp := time.Now()
if opts.TimeStamp != "" {
timeStamp, err = time.Parse(TimeFormat, opts.TimeStamp)
if err != nil {
return errors.Fatalf("error in time option: %v\n", err)
}
}
var targetFS fs.FS = fs.Local{} var targetFS fs.FS = fs.Local{}
if opts.Stdin { if opts.Stdin {
p.V("read data from stdin") p.V("read data from stdin")