The author has developed sqlean-time, a high-precision date/time extension for SQLite, providing a structured API and a variety of functions. Time is represented as a pair of seconds and nanoseconds, allowing for nanosecond precision. You can store time values in their internal representation or as a 64-bit integer of seconds since the Unix epoch. Various functions enable the creation, extraction, comparison, and arithmetic operations on time values. Users can easily add extensions to SQLite with a simple database command. The extension also allows for time comparisons, duration calculations, and precise time rounding. Time values are always stored and operated in UTC but can be converted to a specific timezone offset. This extension offers unique features for date/time manipulation in SQLite databases.
https://antonz.org/sqlean-time/