diff --git a/src/lib.rs b/src/lib.rs index 9914aaf430..b0f47697f7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -215,6 +215,14 @@ impl PartialOrd for Instant { #[cfg(feature = "timer-queue")] 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")] impl ops::AddAssign for Duration { fn add_assign(&mut self, dur: Duration) {