Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
treat timestamp as int64 instead of int
Browse files Browse the repository at this point in the history
  • Loading branch information
travisturner committed Jul 15, 2019
1 parent 5373e3b commit 9c54a9c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions csv/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,23 @@ func ColumnUnmarshallerWithTimestamp(format Format, timestampFormat string) Reco
}
}

timestamp := 0
timestamp := int64(0)
if len(parts) == 3 {
if timestampFormat == "" {
timestamp, err = strconv.Atoi(parts[2])
if err != nil {
if tsInt, err := strconv.Atoi(parts[2]); err != nil {
return nil, err
} else {
timestamp = int64(tsInt)
}
} else {
t, err := time.Parse(timestampFormat, parts[2])
if err != nil {
return nil, err
}
timestamp = int(t.Unix() * int64(time.Second))
timestamp = t.Unix() * int64(time.Second) // Casting a duration to int64 gives the number of nanoseconds in that duration.
}
}
column.Timestamp = int64(timestamp)
column.Timestamp = timestamp

return column, nil
}
Expand Down

0 comments on commit 9c54a9c

Please sign in to comment.