the UUID of version 6 time back
Open
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 440
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/google/uuid/blob/2d3c2a9cc518326daf99a383f07c4d3c44317e4d/time.go#L35
The time in the UUID of version 6 is not strictly monotonically increasing, as the sixth byte is reset by the version. Will it be improved?
As follow code, it will panic with bad
`
t := make([]time.Time, 0, 10000)
for i := 0; i < 10000; i++ {
u, _ := uuid.NewV6()
t = append(t, time.Unix(u.Time().UnixTime()).UTC())
if i > 0 && t[len(t)-1].Before(t[len(t)-2]) {
panic("bad")
}
}
`
Contributor guide
Assessment
This issue has not been assessed yet.