Skip to content

Commit

Permalink
fix comment about the time.Time timezone that is returned from the Ti…
Browse files Browse the repository at this point in the history
…mestamp.Time method and revert to original behavior
  • Loading branch information
nathanmcgarvey-modopayments committed Feb 10, 2025
1 parent 0c5b972 commit de3c87c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit de3c87c

Please sign in to comment.