otoml: gate OTime::now() for wasm32 (hero_rpc#117) #144

Merged
timur merged 1 commit from issue-117-otoml-wasm into development 2026-05-21 16:13:51 +00:00
Owner

Part of hero_rpc#117 — unifies the codegen's SDK-side OTime newtype with the canonical herolib_otoml::OTime.

SystemTime::now() is unavailable on wasm32-unknown-unknown, which blocks SDK consumers from depending on herolib_otoml from WASM builds. Gate just the one method behind #[cfg(not(target_arch = "wasm32"))] — the rest of OTime (from_epoch / from_components / parse / serde / Display) is pure math and remains WASM-safe.

Test plan

  • cargo check --target wasm32-unknown-unknown -p herolib_otoml passes
  • cargo check -p herolib_otoml --tests passes
  • cargo test -p herolib_otoml --lib — 108 tests pass
Part of hero_rpc#117 — unifies the codegen's SDK-side OTime newtype with the canonical `herolib_otoml::OTime`. `SystemTime::now()` is unavailable on `wasm32-unknown-unknown`, which blocks SDK consumers from depending on herolib_otoml from WASM builds. Gate just the one method behind `#[cfg(not(target_arch = "wasm32"))]` — the rest of `OTime` (`from_epoch` / `from_components` / `parse` / serde / `Display`) is pure math and remains WASM-safe. ## Test plan - [x] `cargo check --target wasm32-unknown-unknown -p herolib_otoml` passes - [x] `cargo check -p herolib_otoml --tests` passes - [x] `cargo test -p herolib_otoml --lib` — 108 tests pass
otoml: gate OTime::now() to non-wasm targets (#117)
Some checks failed
Lint / lint-linux (pull_request) Successful in 50s
Tests with Services / test-linux (pull_request) Failing after 13m20s
28420b409d
SystemTime::now() is unavailable on wasm32-unknown-unknown, which blocks
SDK consumers from depending on herolib_otoml from WASM builds. Gate
just the one method behind #[cfg(not(target_arch = "wasm32"))] — the
rest of OTime (from_epoch / from_components / parse / serde / Display)
is pure math and remains WASM-safe.

WASM consumers construct OTime via from_epoch / parse / Default
(produces the Unix epoch, which serializes to the valid 19-char
"1970-01-01 00:00:00" string).

Refs: hero_rpc#117 — unifies the codegen's SDK-side OTime newtype with
the canonical herolib_otoml::OTime.
timur merged commit 16b7185488 into development 2026-05-21 16:13:51 +00:00
timur deleted branch issue-117-otoml-wasm 2026-05-21 16:13:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_lib!144
No description provided.