fix(sqlite): correct sub-second decoding of pre-epoch REAL datetimes (#4340)
Datetimes stored as a REAL Julian day number (e.g. via SQLite's julianday()) were decoded by splitting the UNIX timestamp with trunc()/fract().abs(). timestamp_opt() always adds the nanoseconds forward in time, so for values before 1970 this pushed the result up to ~2 seconds off and could move it onto the wrong side of the epoch (e.g. 1969-12-31 23:59:59.5 decoded as 1970-01-01 00:00:00.5). Round seconds toward negative infinity with floor() and take the sub-second remainder relative to that, so nanos is always a valid forward offset. Post-epoch values are unaffected. Adds unit tests for the pre- and post-epoch paths.
Z
Zane Wang committed
4fc0fb822a186a725302ca20c932b1ac6fd59c5d
Parent: 80f44db
Committed by GitHub <noreply@github.com>
on 8/19/2026, 11:18:36 PM