aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-19 16:15:38 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-19 16:15:38 +0000
commit43c2ffbdcfcf96382dbe5e5a64b2af90a447636d (patch)
tree2fa41ed3b4af06d7d53f22eedff02a3b20c54b51
parentc91b14bcd49f05ea40617dbd3166afa63234cb91 (diff)
parent3973b420ec63da6b09f8f174247d79c2679b269f (diff)
Merge #154
154: add Duration.as_cycles r=japaric a=japaric cc @oni303 Co-authored-by: Jorge Aparicio <jorge@japaric.io>
-rw-r--r--src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9914aaf..b0f4769 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;