Closed
Description
In line 141: if now == n.time {
, I think it has a little problem:
If the time on the machine falls back(now<n.time), duplicate IDS will be generated.
The right way should be like sonyflke (https://github.com/sony/sonyflake/blob/master/sonyflake.go#L96)
This project has the most stars on github. I hope it's perfect. Haha.
Activity
bwmarrin commentedon Jul 30, 2019
Maybe take a look at the details in this PR :)
#18
In Go, 1.9 and later, time package uses a monotonic clock for time-measuring operations.