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

Method Time

time.go:117–135  ·  time.go::UUID.Time

Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in uuid. The time is only defined for version 1, 2, 6 and 7 UUIDs.

()

Source from the content-addressed store, hash-verified

115// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in
116// uuid. The time is only defined for version 1, 2, 6 and 7 UUIDs.
117func (uuid UUID) Time() Time {
118 var t Time
119 switch uuid.Version() {
120 case 6:
121 time := int64(binary.BigEndian.Uint32(uuid[0:4])) << 28
122 time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 12
123 time |= int64(binary.BigEndian.Uint16(uuid[6:8]) & 0xfff)
124 t = Time(time)
125 case 7:
126 time := binary.BigEndian.Uint64(uuid[:8])
127 t = Time((time>>16)*10000 + g1582ns100)
128 default: // forward compatible
129 time := int64(binary.BigEndian.Uint32(uuid[0:4]))
130 time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
131 time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
132 t = Time(time)
133 }
134 return t
135}
136
137// ClockSequence returns the clock sequence encoded in uuid.
138// The clock sequence is only well defined for version 1 and 2 UUIDs.

Callers 4

TestVersion1Function · 0.95
TestNodeAndTimeFunction · 0.80
TestVersion6Function · 0.80
TestNewV6WithTimeFunction · 0.80

Calls 2

VersionMethod · 0.95
TimeTypeAlias · 0.85

Tested by 4

TestVersion1Function · 0.76
TestNodeAndTimeFunction · 0.64
TestVersion6Function · 0.64
TestNewV6WithTimeFunction · 0.64