Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofmodule zinput.module·originates fromworld 07158574-5…

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

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

ZinputClock Module 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). The engine's per-frame `getTime()` (seconds since engine start, published from the native clock) 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. The source is injectable via `_setClock`, so timing-dependent logic can be driven by a controllable clock (deterministic tests, fixed-step replay).

nowSeconds( ) → number

Current wall-clock seconds for input timing. Reads the engine's per-frame `getTime()`, falling back to `os.clock()` where no engine time surface exists. Honors a clock injected via `_setClock`.

examples

local t = require("modules.zinput.clock").nowSeconds()

_setClock(fn: (() → void

Internal: override the input clock with `fn` (returns seconds), or pass `nil` to restore the engine clock. Exposed for deterministic timing — fixed-step replay and tests that need a controllable clock.

argtypedescription
fn((A clock returning seconds, or `nil` to restore the default source.

examples

require("modules.zinput.clock")._setClock(function() return t end)

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

2items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · modules/zinput.module/clock.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.