aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9914aaf4..b0f47697 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -216,6 +216,14 @@ impl PartialOrd for Instant {
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) {
self.0 += dur.0;