Skip to content

Remove boottime from quark times#368

Open
nicholasberlin wants to merge 1 commit into
mainfrom
time-since-boot
Open

Remove boottime from quark times#368
nicholasberlin wants to merge 1 commit into
mainfrom
time-since-boot

Conversation

@nicholasberlin

Copy link
Copy Markdown
Contributor

Times derived from quark.boottime were computed once and stored, so a system clock step after quark_init() (say NTP correcting a clock that was wrong at boot) left every stored and emitted timestamp shifted by the step size until restart.

Nothing computed with quark.boottime is stored or handed out anymore: qev->time, proc_time_boot and exit_time_event are raw ns since boot, translated at the last moment with the new quark_time_to_wallclock(). Since quark has no event loop, keeping the epoch honest is the user's job: detect a step (a CLOCK_REALTIME timerfd with TFD_TIMER_CANCEL_ON_SET, or polling the CLOCK_REALTIME - CLOCK_BOOTTIME delta, which only moves on steps) and call the new quark_update_boottime(). Corrections then apply retroactively to any raw time, including events that predate the step.

This also makes proc_entity_id immune to clock changes, as it now hashes the raw start time.

Breaking change: consumers that treated qev->time, proc_time_boot or exit_time_event as wallclock epoch ns must translate via quark_time_to_wallclock().

Times derived from quark.boottime were computed once and stored, so a
system clock step after quark_init() (say NTP correcting a clock that
was wrong at boot) left every stored and emitted timestamp shifted by
the step size until restart.

Nothing computed with quark.boottime is stored or handed out anymore:
qev->time, proc_time_boot and exit_time_event are raw ns since boot,
translated at the last moment with the new quark_time_to_wallclock().
Since quark has no event loop, keeping the epoch honest is the user's
job: detect a step (a CLOCK_REALTIME timerfd with
TFD_TIMER_CANCEL_ON_SET, or polling the CLOCK_REALTIME -
CLOCK_BOOTTIME delta, which only moves on steps) and call the new
quark_update_boottime(). Corrections then apply retroactively to any
raw time, including events that predate the step.

This also makes proc_entity_id immune to clock changes, as it now
hashes the raw start time.

Breaking change: consumers that treated qev->time, proc_time_boot or
exit_time_event as wallclock epoch ns (endpoint, go-quark) must
translate via quark_time_to_wallclock().
@nicholasberlin
nicholasberlin requested a review from a team as a code owner July 17, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant