~whereswaldon/forest-go

133031baad4c623941d66e52e33bf1987d9e0279 — Chris Waldon 1 year, 5 months ago 28efb6f main
fields: fix 32-bit time truncation

This commit fixes a problem that would incorrectly construct time.Time's on 32-bit
platforms by truncating the time value when casting to a uint.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
1 files changed, 2 insertions(+), 2 deletions(-)

M fields/primitives.go
M fields/primitives.go => fields/primitives.go +2 -2
@@ 241,8 241,8 @@ func TimestampFrom(t time.Time) Timestamp {
}

func (t Timestamp) Time() time.Time {
	sec := (uint(t) / 1000)
	nsec := (uint(t) % 1000) * nanosPerMilli
	sec := (uint64(t) / 1000)
	nsec := (uint64(t) % 1000) * nanosPerMilli
	return time.Unix(int64(sec), int64(nsec))
}