Skip to content

Commit

Permalink
Use proper timezone in the timestamp received from barman-cloud-backu…
Browse files Browse the repository at this point in the history
…p-list

Signed-off-by: Igor Shishkin <[email protected]>
  • Loading branch information
teran authored and litaocdl committed Aug 27, 2024
1 parent 813cd63 commit 38403b7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/management/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,20 @@ func (b *BarmanBackup) deserializeBackupTimeStrings() error {
barmanTimeLayout = "Mon Jan 2 15:04:05 2006"
)

var err error
if b.BeginTimeString != "" {
b.BeginTime, err = time.Parse(barmanTimeLayout, b.BeginTimeString)
ts, err := time.Parse(barmanTimeLayout, b.BeginTimeString)
if err != nil {
return err
}
b.BeginTime = time.Date(ts.Year(), ts.Month(), ts.Day(), ts.Hour(), ts.Minute(), ts.Second(), ts.Nanosecond(), time.Local)
}

if b.EndTimeString != "" {
b.EndTime, err = time.Parse(barmanTimeLayout, b.EndTimeString)
ts, err := time.Parse(barmanTimeLayout, b.EndTimeString)
if err != nil {
return err
}
b.EndTime = time.Date(ts.Year(), ts.Month(), ts.Day(), ts.Hour(), ts.Minute(), ts.Second(), ts.Nanosecond(), time.Local)
}

return nil
Expand Down

0 comments on commit 38403b7

Please sign in to comment.