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