Open
Description
When using NewWithTime
, the time object Unix
method returns a uint64 which is then cast into a uint32.
Using a future time which exceeds uint32, the xid object returns the wrong timestamp.
Code example:
nt := time.Unix(4294967296, 0).UTC()
fmt.Println("time wrap around: ", nt)
idd := xid.NewWithTime(nt)
fmt.Println("xid time vs actual: ", idd.Time().Unix(), nt.Unix())
output:
time wrap around: 2106-02-07 06:28:16 +0000 UTC
xid time vs actual: 0 4294967296
0 1970-01-01 00:00:00 +0000 UTC
I feel the need to emphasize that this is not a "future" problem. This is a current issue that impacts code today.
xid needs to respect time object values whether past, present and future and is expected to return the correct object when xid.Time()
is called
Metadata
Assignees
Labels
No labels
Activity