diff options
author | 2019-02-19 17:14:34 +0100 | |
---|---|---|
committer | 2019-02-19 17:14:34 +0100 | |
commit | 3973b420ec63da6b09f8f174247d79c2679b269f (patch) | |
tree | 2fa41ed3b4af06d7d53f22eedff02a3b20c54b51 /src | |
parent | c91b14bcd49f05ea40617dbd3166afa63234cb91 (diff) | |
download | rtic-3973b420ec63da6b09f8f174247d79c2679b269f.tar.gz rtic-3973b420ec63da6b09f8f174247d79c2679b269f.tar.zst rtic-3973b420ec63da6b09f8f174247d79c2679b269f.zip |
add Duration.as_cycles
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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; |