File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,9 @@ func (uuid UUID) Time() Time {
113113 var t Time
114114 switch uuid .Version () {
115115 case 6 :
116- time := binary .BigEndian .Uint64 (uuid [:8 ]) // Ignore uuid[6] version b0110
116+ time := int64 (binary .BigEndian .Uint32 (uuid [0 :4 ])) << 28
117+ time |= int64 (binary .BigEndian .Uint16 (uuid [4 :6 ])) << 12
118+ time |= int64 (binary .BigEndian .Uint16 (uuid [6 :8 ]) & 0xfff )
117119 t = Time (time )
118120 case 7 :
119121 time := binary .BigEndian .Uint64 (uuid [:8 ])
Original file line number Diff line number Diff line change @@ -39,12 +39,16 @@ func NewV6() (UUID, error) {
3939 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4040 */
4141
42- binary .BigEndian .PutUint64 (uuid [0 :], uint64 (now ))
42+ timeHigh := uint32 ((now >> 28 ) & 0xffffffff )
43+ timeMid := uint16 ((now >> 12 ) & 0xffff )
44+ timeLow := uint16 (now & 0x0fff )
45+ timeLow |= 0x6000 // Version 6
46+
47+ binary .BigEndian .PutUint32 (uuid [0 :], timeHigh )
48+ binary .BigEndian .PutUint16 (uuid [4 :], timeMid )
49+ binary .BigEndian .PutUint16 (uuid [6 :], timeLow )
4350 binary .BigEndian .PutUint16 (uuid [8 :], seq )
4451
45- uuid [6 ] = 0x60 | (uuid [6 ] & 0x0F )
46- uuid [8 ] = 0x80 | (uuid [8 ] & 0x3F )
47-
4852 nodeMu .Lock ()
4953 if nodeID == zeroID {
5054 setNodeInterface ("" )
You can’t perform that action at this time.
0 commit comments