Skip to content

Refactor to use compile-time time provider verification#1

Merged
yukibtc merged 1 commit intomasterfrom
failt-at-compile
Feb 24, 2026
Merged

Refactor to use compile-time time provider verification#1
yukibtc merged 1 commit intomasterfrom
failt-at-compile

Conversation

@yukibtc
Copy link
Member

@yukibtc yukibtc commented Feb 24, 2026

Changed the library to fail at link-time instead of runtime when no time provider is available on no_std platforms. This ensures you can't accidentally deploy code that panics when calling time functions.

Key changes:

  • Use std::time automatically on supported platforms (zero overhead)
  • Require define_time_provider! macro on no_std/WASM-unknown
  • Link errors (not runtime panics) if provider missing
  • Disabled global module on std platforms
  • Moved tests from tests/ directory into inline modules

Changed the library to fail at link-time instead of runtime when no time provider is available on no_std platforms. This ensures you can't
accidentally deploy code that panics when calling time functions.

Key changes:
- Use std::time automatically on supported platforms (zero overhead)
- Require define_time_provider! macro on no_std/WASM-unknown
- Link errors (not runtime panics) if provider missing
- Disabled global module on std platforms
- Moved tests from tests/ directory into inline modules

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
@yukibtc yukibtc merged commit de3286e into master Feb 24, 2026
4 checks passed
@yukibtc yukibtc deleted the failt-at-compile branch February 24, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant