MCPcopy
hub / github.com/google/uuid / makeV7

Function makeV7

version7.go:48–75  ·  view source on GitHub ↗

makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6]) uuid[8] already has the right version number (Variant is 10) see function NewV7 and NewV7FromReader

(uuid []byte)

Source from the content-addressed store, hash-verified

46// uuid[8] already has the right version number (Variant is 10)
47// see function NewV7 and NewV7FromReader
48func makeV7(uuid []byte) {
49 /*
50 0 1 2 3
51 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
52 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 | unix_ts_ms |
54 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
55 | unix_ts_ms | ver | rand_a (12 bit seq) |
56 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57 |var| rand_b |
58 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59 | rand_b |
60 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61 */
62 _ = uuid[15] // bounds check
63
64 t, s := getV7Time()
65
66 uuid[0] = byte(t >> 40)
67 uuid[1] = byte(t >> 32)
68 uuid[2] = byte(t >> 24)
69 uuid[3] = byte(t >> 16)
70 uuid[4] = byte(t >> 8)
71 uuid[5] = byte(t)
72
73 uuid[6] = 0x70 | (0x0F & byte(s>>8))
74 uuid[7] = byte(s)
75}
76
77// lastV7time is the last time we returned stored as:
78//

Callers 2

NewV7Function · 0.85
NewV7FromReaderFunction · 0.85

Calls 1

getV7TimeFunction · 0.85

Tested by

no test coverage detected