-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
Port hardware clocks to new clocksource API #710
Comments
yep, agreed. Been on my to-do list, just haven't gotten around to it. This one is solely about clock sources; next up would be a hardware timer abstraction. |
I'll make an attempt on this |
what does the porting entail? Can you elaborate? |
Great!
We need to implement the ClockSource trait for the clocks. The TSC should be the easiest to start with. We'll want to implement the trait for a zero-sized type like so: pub struct Tsc;
impl ClockSource for Tsc {
// ...
} The TSC is a monotonic clock source, so |
I noticed that |
The naming may be confusing. pub struct Tsc;
impl time::ClockSource for Tsc {
type ClockType = time::Monotonic;
// ...
} BTW it's probably best to create a new PR for each clock source port, e.g. a PR modifying only |
I'm working on TSC now. The trait
This is probably due to the fact that the trait definition
Because the trait definition requires you to be consistent with the return type regardless of whether you use monotonic clock or wall clock. Should we reconsider the policy of using different return types for monotonic and wall clocks? Or is there a way to achieve different return types for different implementations of the same trait? |
Here is what I have so far in
|
😬 oops sorry, the doc comments are wrong. They should say "Wall time", not "Monotonic", i.e. "Wall time clocks should just return the [ This is because for wall time clocks, But for monotonic clocks, |
Does your correction apply also to |
ok so what should I do while waiting for #739 to be merged? Anything I can work on meanwhile? |
#739 has been merged in 🎉 |
We should port the hardware clock sources to the new API added in #615.
The text was updated successfully, but these errors were encountered: