Is there a better way to convert quantity time to chrono nanoseconds? #268
Replies: 2 comments 8 replies
-
|
Beta Was this translation helpful? Give feedback.
8 replies
Answer selected by
ManuelMeraz
-
@ManuelMeraz, I think there's room for a potential improvement to the library here. Au, the units library I wrote, has unit-aware inverse functions. When combined with implicit conversions with the chrono library, you could automatically generate code which, under the hood, divides your frequency value into void spin_wait(au::QuantityI64<au::Hertz> frequency) {
m_wait_time = au::inverse_as(au::nano(au::seconds), frequency);
} Assuming It may be worth considering a similar addition to mp-units. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently converting frequency to a chrono time period doing the following
Is there a more succinct way of achieving this?
Beta Was this translation helpful? Give feedback.
All reactions