Skip to content

Commit

Permalink
Use new API from_nanoseconds in uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
Feoramund committed Jun 22, 2024
1 parent 8a4a3ed commit ca58d77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/encoding/uuid/reading.odin
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Returns:
- timestamp: The timestamp of the UUID.
*/
time_v1 :: proc "contextless" (id: Identifier) -> (timestamp: time.Time) {
return { _nsec = cast(i64)(raw_time_v1(id) - HNS_INTERVALS_BETWEEN_GREG_AND_UNIX) * 100 }
return time.from_nanoseconds(cast(i64)(raw_time_v1(id) - HNS_INTERVALS_BETWEEN_GREG_AND_UNIX) * 100)
}

/*
Expand Down Expand Up @@ -194,7 +194,7 @@ Returns:
- timestamp: The timestamp, in 100-nanosecond intervals since 1582-10-15.
*/
time_v6 :: proc "contextless" (id: Identifier) -> (timestamp: time.Time) {
return { _nsec = cast(i64)(raw_time_v6(id) - HNS_INTERVALS_BETWEEN_GREG_AND_UNIX) * 100 }
return time.from_nanoseconds(cast(i64)(raw_time_v6(id) - HNS_INTERVALS_BETWEEN_GREG_AND_UNIX) * 100)
}

/*
Expand All @@ -221,7 +221,7 @@ Returns:
- timestamp: The timestamp, in milliseconds since the UNIX epoch.
*/
time_v7 :: proc "contextless" (id: Identifier) -> (timestamp: time.Time) {
return { _nsec = cast(i64)raw_time_v7(id) * 1e6 }
return time.from_nanoseconds(cast(i64)raw_time_v7(id) * 1e6)
}

/*
Expand Down

0 comments on commit ca58d77

Please sign in to comment.