aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/google/uuid/time.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/uuid/time.go')
-rw-r--r--vendor/github.com/google/uuid/time.go21
1 files changed, 5 insertions, 16 deletions
diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go
index c35112927..e6ef06cdc 100644
--- a/vendor/github.com/google/uuid/time.go
+++ b/vendor/github.com/google/uuid/time.go
@@ -108,23 +108,12 @@ func setClockSequence(seq int) {
}
// 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.
+// uuid. The time is only defined for version 1 and 2 UUIDs.
func (uuid UUID) Time() Time {
- var t Time
- switch uuid.Version() {
- case 6:
- time := binary.BigEndian.Uint64(uuid[:8]) // Ignore uuid[6] version b0110
- t = Time(time)
- case 7:
- time := binary.BigEndian.Uint64(uuid[:8])
- t = Time((time>>16)*10000 + g1582ns100)
- default: // forward compatible
- time := int64(binary.BigEndian.Uint32(uuid[0:4]))
- time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
- time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
- t = Time(time)
- }
- return t
+ time := int64(binary.BigEndian.Uint32(uuid[0:4]))
+ time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
+ time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
+ return Time(time)
}
// ClockSequence returns the clock sequence encoded in uuid.