▣
module · drop-in viewer
clock
The wall-clock time source for zinput's time-window features — held-time and synthetic key repeat (`state`), chord step / total windows (`chords`), and the tick's fallback delta (`init`).
by·posted 2mo ago
What it does
zinput / clock
The wall-clock time source for zinput's time-window features — held-time and
synthetic key repeat (state), chord step / total windows (chords), and the
tick's fallback delta (init).
nowSeconds() reads the engine's per-frame getTime() (seconds since engine
start, published from the native clock), which advances with wall time on every
platform. os.clock measures CPU time and barely moves across scheduler yields
on wasm, so it is only the fallback for contexts with no engine time surface.
API
nowSeconds() -> number— current wall-clock seconds for input timing._setClock(fn: (() -> number)?)— internal; override the clock withfn(returns seconds) ornilto restore the default. For deterministic timing: fixed-step replay and tests that need a controllable clock.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.