Format of mtime and atime in the files table?

Querying the sqlite db directly I see entries like (25250 48408 228748 965000), but I don’t recognize that format.


(format-time-string "%Y-%m-%dT%H:%m:%S%z" '(25250 48408 228748 965000))

;; I get this:
;; => "2022-06-10T05:06:08+0200"

You can read the doc string of format-time-string and decode-time, perhaps?

Yes, that.

But, I was trying to get it and use it from outside emacs completely.

$ sqlite3 ~/.emacs.d/org-roam.db "select mtime from files limit 1"
(25300 49575 679763 676000)

I’ll have to read those docs and see if i can figure out how to make it human readable.


It’s probably this:

list of four integers (high low micro pico), where 0≤low<65536, 0≤micro<1000000, and 0≤pico<1000000. This represents the number of seconds using the formula: high * 216 + low + micro * 10-6 + pico * 10**-12. In some cases, functions may default to returning two- or three-element lists, with omitted micro and pico components defaulting to zero. On all current machines pico is a multiple of 1000, but this may change as higher-resolution clocks become available.

I believe the convert-time is a C function. Perhaps you could take it out and compile only that function to use for your purpose?

Or modify org-roam code to store Unix epoch time or time-string to begin with, and update the whole cache database?

The latter might be quicker than trying to understand the math behind…

I would advice to skim through documentation of emacsql to check its limitations.