-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timer functions should maybe not take milliseconds as an argument #11189
Comments
Ideally these would take a "Time" or "Duration" structure which has nanosecond precision (or something like that). Nominating because this API will determine the backwards compatibility of timers. |
+1 for a Duration type or at the very least a unit and magnitude (e.g. |
One thought I had this morning is that if we don't have a solution for a "time type" by 1.0, we could rename all these functions to |
Accepted for 1.0 backcompat-libs. |
If we create a duration type here we should consider it's forward compatibility with #14657. We may end up in a situation where |
It may end up being the case that this is the correct API for the standard library, and the correponding time library will provide an extension trait to use an external |
The rust-chrono Duration type supports ns: https://github.com/lifthrasiir/rust-chrono/blob/master/src/chrono/duration.rs |
cc @lifthrasiir discussing how timers want a duration type. |
I have a branch that does the following:
Looking for feedback. |
The public API should probably use |
@huonw FYI, rust-chrono now uses |
Taken from rust-chrono[1]. Needed for timers per rust-lang#11189. Experimental. [1]: https://github.com/lifthrasiir/rust-chrono
Taken from rust-chrono[1]. Needed for timers per rust-lang#11189. Experimental. [1]: https://github.com/lifthrasiir/rust-chrono
[significant_drop_tightening] Fix rust-lang#11189 Fix rust-lang#11189 ``` changelog: FP: [`significant_drop_tightening`]: Consider tuples in drop calls ```
System timers often expose a granularity much more fine than one millisecond. Right now this is an artifact of libuv's api, but in a 1:1 context you can get much finer-grained control over this.
Perhaps the arguments should be a (second/nsec) struct (like in C), with sugar to do the "easy thing"
The text was updated successfully, but these errors were encountered: