Expand description
Universal Clock + Timer port for the ppoppo workspace.
Single deep-module port hiding the time-source substrate from every consumer.
Three impl arms gated by feature: native (Tokio), wasm (js_sys::Date +
Intl tz-name probe + Window.setTimeout), mock (FrozenClock + MockClock +
AdvanceableTimer). Zone math is arm-independent: jiff’s bundled tzdb makes
now_in/today_in provided methods — each arm implements only now().
§SSOT relationship
Standards: STANDARDS_TIME_MECHANICS.md §“Universal client + server time port”
(jiff surface per RFC_202607130309_jiff-migration). Engine precedent:
ppoppo-token (1st-party-consumed primitive, surface via SDK re-export).
External Developer Apps consume via pas_external::clock::* — never
path-dep this crate.
§Dart mirror (CFC)
apps/cfc/lib/clock.dart is the hand-maintained Dart shape mirror. Drift
detection deferred to a follow-up RFC. When changing trait shape here,
update the Dart mirror in the same commit.
§Temporal alignment
jiff is the Rust realization of the TC39 Temporal model (Timestamp ≙
Temporal.Instant, Zoned ≙ Temporal.ZonedDateTime, civil::Date ≙
Temporal.PlainDate, tz::TimeZone ≙ Temporal.TimeZone). The pre-jiff
plan to swap the wasm arm onto js_sys::Temporal is obsolete — the model
already lives in-process, identically on every arm.
Re-exports§
pub use jiff;
Traits§
- Clock
- Wall-clock readouts. Single port for “what time is it?” across all surfaces.
- Timer
- Async scheduling primitive. Single port for “wait N ms” / “yield event-loop tick”.