mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-24 04:32:52 +01:00
Merge #154
154: add Duration.as_cycles r=japaric a=japaric cc @oni303 Co-authored-by: Jorge Aparicio <jorge@japaric.io>
This commit is contained in:
commit
43c2ffbdcf
1 changed files with 8 additions and 0 deletions
|
@ -215,6 +215,14 @@ impl PartialOrd for Instant {
|
||||||
#[cfg(feature = "timer-queue")]
|
#[cfg(feature = "timer-queue")]
|
||||||
pub struct Duration(u32);
|
pub struct Duration(u32);
|
||||||
|
|
||||||
|
#[cfg(feature = "timer-queue")]
|
||||||
|
impl Duration {
|
||||||
|
/// Returns the total number of clock cycles contained by this `Duration`
|
||||||
|
pub fn as_cycles(&self) -> u32 {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "timer-queue")]
|
#[cfg(feature = "timer-queue")]
|
||||||
impl ops::AddAssign for Duration {
|
impl ops::AddAssign for Duration {
|
||||||
fn add_assign(&mut self, dur: Duration) {
|
fn add_assign(&mut self, dur: Duration) {
|
||||||
|
|
Loading…
Reference in a new issue