Skip to main content

Crate rusty_time_wasm

Crate rusty_time_wasm 

Source
Expand description

rusty_time-wasm — disciplined time for the browser and the edge.

This is the capability chrony cannot follow us into. There is no OS clock to adjust here and no UDP socket to use, so instead of setting time this crate estimates it: the page keeps calling now_ms() and gets a corrected reading, with an honest error bound attached.

The split is deliberate. JavaScript owns the transport — fetch, WebTransport, a worker, whatever the page has — and this crate owns the time math. That keeps the protocol identical to the native client (the same packet codec, the same regression filter, both already fuzzed) and leaves the one part that genuinely differs per environment in the environment’s own hands.

The wire format is a real NTPv4 packet, not a JSON shape invented for the browser: one codec, one set of tests, and a gateway that is an NTP server with an HTTP door on it.

Structs§

TimeClient
A disciplined view of time for a page or an edge function.