From 9c54a9c43802ab441cd31c24de1cd7ecc2ddb679 Mon Sep 17 00:00:00 2001 From: Travis Date: Mon, 15 Jul 2019 15:49:36 -0500 Subject: [PATCH] treat timestamp as int64 instead of int --- csv/csv.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/csv/csv.go b/csv/csv.go index ffbefbe..a8613b7 100644 --- a/csv/csv.go +++ b/csv/csv.go @@ -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 }