Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

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 with fn (returns seconds) or nil to restore the default. For deterministic timing: fixed-step replay and tests that need a controllable clock.