DXist / boot-time

Suspend-aware monotonic time for Rust
MIT License
2 stars 0 forks source link

Unsupported platforms don't fall back #1

Closed CryZe closed 1 year ago

CryZe commented 1 year ago

The documentation claims the following:

Otherwise is uses monotonic time.

But on unsupported platforms, the code actually just panics: https://github.com/DXist/boot-time/blob/3209bfd0c931ccfcbfa7efd4574dbd2dbfc4bbee/src/sys/unsupported.rs#L7-L9

I think it would make sense to indeed just fall back to std's Instant.

Also as a side note: emscripten doesn't actually implement boot time, because it's not really based on the Linux kernel, so it errors out instead. Fuchsia also doesn't implement it, but it doesn't hurt using it there at least.

DXist commented 1 year ago

Thank you for prompt feedback!

I've reexported std::time::Instant for Windows (QueryPerformanceCounter is suspend-aware) and for other platforms unsupported by this crate.

Switched Emscripten/Fuchsia to use CLOCK_MONOTONIC fallback.

CryZe commented 1 year ago

Nice, looks good :)