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

Method Time

time.go:112–128  ·  view source on GitHub ↗

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

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

Callers 3

TestVersion1Function · 0.95
TestNodeAndTimeFunction · 0.80
TestVersion6Function · 0.80

Calls 2

VersionMethod · 0.95
TimeTypeAlias · 0.85

Tested by 3

TestVersion1Function · 0.76
TestNodeAndTimeFunction · 0.64
TestVersion6Function · 0.64