aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/google/uuid/time.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-01-18 17:24:16 +0100
committerTaras Madan <tarasmadan@google.com>2024-01-18 16:35:00 +0000
commit21772ce4342bc8ecbb3e7c8747bba9aec14f3bbb (patch)
tree74b7a3823242a8c79fd1d365aae660fdcd4a19d3 /vendor/github.com/google/uuid/time.go
parentdf0ec93c2662a5189ec2077aee2bf823e392bf25 (diff)
Revert "mod: do: bump google.golang.org/api from 0.153.0 to 0.156.0"
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.