From de3c87c080af9a81aeddde37ebcc36718a4ac2bf Mon Sep 17 00:00:00 2001 From: Nathan McGarvey Date: Sun, 9 Feb 2025 15:33:59 -0600 Subject: [PATCH] fix comment about the time.Time timezone that is returned from the Timestamp.Time method and revert to original behavior --- uuid.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/uuid.go b/uuid.go index e08d9e5..43f68f5 100644 --- a/uuid.go +++ b/uuid.go @@ -88,12 +88,16 @@ type Timestamp uint64 const _100nsPerSecond = 10000000 -// Time returns the UTC time.Time representation of a Timestamp +// Time returns the time.Time representation of a Timestamp. +// +// The resulting time.Time: +// - Contains only wall clock time (no monotonic clock component) +// - Uses the local system timezone for the location func (t Timestamp) Time() (time.Time, error) { secs := uint64(t) / _100nsPerSecond nsecs := 100 * (uint64(t) % _100nsPerSecond) - return time.Unix(int64(secs)-(epochStart/_100nsPerSecond), int64(nsecs)).UTC(), nil + return time.Unix(int64(secs)-(epochStart/_100nsPerSecond), int64(nsecs)), nil } // TimestampFromV1 returns the Timestamp embedded within a V1 UUID.