We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 893c323 commit b6353aeCopy full SHA for b6353ae
uuid.go
@@ -147,7 +147,10 @@ func TimestampFromV7(u UUID) (Timestamp, error) {
147
(int64(u[4]) << 8) |
148
int64(u[5])
149
150
- // convert to format expected by Timestamp
+ // UUIDv7 stores MS since 1979-01-01 00:00:00, but the Timestamp
151
+ // type stores 100-nanosecond increments since 1582-10-15 00:00:00.
152
+ // This conversion multiplies ms by 10,000 to get 100-ns chunks and adds
153
+ // the difference between October 1582 and January 1979.
154
tsNanos := epochStart + (t * _100nsPerMillisecond)
155
return Timestamp(tsNanos), nil
156
}
0 commit comments