pelikan-io / rustcommon

Common Rust library
Apache License 2.0
26 stars 13 forks source link

`clocksource` does not support windows #90

Closed rushiiMachine closed 11 months ago

rushiiMachine commented 11 months ago

clocksource (and in turn, ratelimit) relies on an UNIX time API, making this library unusable on other platforms

https://github.com/pelikan-io/rustcommon/blob/89633481ec10e7ca1f389522471f22de54afba04/clocksource/src/precise/instant.rs#L29-L35

Expected behavior

Use either

  1. std::time::Instant instead which already provides all platform implementations
  2. Instant doesn't seem to provide raw ns values, so to avoid rewriting half the lib but I found a different lib that does: quanta
brayniac commented 11 months ago

Thanks for opening this. We need the raw times in clocksource for a variety of reasons. Neither the std library nor quanta really fit the specific needs.

I believe clocksource should just be extended to provide coverage for other platforms as-needed.

brayniac commented 11 months ago

This is fixed by #92 - new versions of all crates are published. Please open a new issue if you discover any problems.