Skip to content

Commit

Permalink
it's not easy to parse the monotonic clock, try without it
Browse files Browse the repository at this point in the history
Signed-off-by: Vladik Romanovsky <[email protected]>
  • Loading branch information
vladikr committed Feb 5, 2024
1 parent 1888197 commit 92d851d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/backend/logsHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,17 @@ func getMustGatherTimestamp() (time.Time, error) {

func timestampStringToTime(timestamp string) (time.Time, error) {
const layout = "2006-01-02 15:04:05.999999999 -0700 MST m=+0.000000000"
const layoutNoMono = "2006-01-02 15:04:05.999999999 -0700 MST"

t, err := time.Parse(layout, timestamp)
if err != nil {
return time.Time{}, err
// remove the monolithic offset if we can't parse it
parts := strings.Split(timestamp, " m=")

t, err = time.Parse(layoutNoMono, parts[0])
if err != nil {
return time.Time{}, err
}
}

return t, nil
Expand Down

0 comments on commit 92d851d

Please sign in to comment.