From 3973b420ec63da6b09f8f174247d79c2679b269f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 19 Feb 2019 17:14:34 +0100 Subject: [PATCH] add Duration.as_cycles --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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) {