NewV6WithTime returns a Version 6 UUID based on the current NodeID, clock sequence, and a specified time. It is similar to the NewV6 function, but allows you to specify the time. If time is passed as nil, then the current time is used. There is a limit on how many UUIDs can be generated for the sam
(customTime *time.Time)
| 37 | // are generating multiple UUIDs, it is recommended to increment the time. |
| 38 | // If getTime fails to return the current NewV6WithTime returns Nil and an error. |
| 39 | func NewV6WithTime(customTime *time.Time) (UUID, error) { |
| 40 | now, seq, err := getTime(customTime) |
| 41 | if err != nil { |
| 42 | return Nil, err |
| 43 | } |
| 44 | |
| 45 | return generateV6(now, seq), nil |
| 46 | } |
| 47 | |
| 48 | func generateV6(now Time, seq uint16) UUID { |
| 49 | var uuid UUID |