Module clock

Source
Expand description

Unix timestamps shared by catalog and conclusion stores.

Small enough to be tempting to rewrite on the spot — which is exactly what had happened, in three places, each with its own answer to “and if the clock is before 1970?”. A scan date, an integrity date and an import date have to be comparable, so they come from here.

Functions§

mtime_nanoseconds
A report file’s modification time, with the same precision as new results.
mtime_seconds
Modification date of a file, in seconds since the Unix epoch.
mtime_subseconds
Nanosecond fraction of a file’s modification date, or 0 when unavailable.
now_nanoseconds
Now with subsecond precision, for ordering analysis results produced in quick succession. File identity stores seconds and the fractional part separately so both integers survive the JSON representation exactly.
now_seconds
Now, in seconds since the Unix epoch.