diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2019-06-24 14:09:12 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2019-06-24 14:09:12 +0200 |
| commit | 596cf585ea8dc278d88e0652dffbacbc75de04c6 (patch) | |
| tree | 147bad178f15a7e7a91d847f39d501ecc1051821 /src/cyccnt.rs | |
| parent | 4e51bb68b976c6bb6a9a989dc560d2a8123a84ca (diff) | |
Monotonic trait is safe; add MultiCore trait
Diffstat (limited to 'src/cyccnt.rs')
| -rw-r--r-- | src/cyccnt.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cyccnt.rs b/src/cyccnt.rs index a2b216c..468aa71 100644 --- a/src/cyccnt.rs +++ b/src/cyccnt.rs @@ -116,6 +116,11 @@ pub struct Duration { } impl Duration { + /// Creates a new `Duration` from the specified number of clock cycles + pub fn from_cycles(cycles: u32) -> Self { + Duration { inner: cycles } + } + /// Returns the total number of clock cycles contained by this `Duration` pub fn as_cycles(&self) -> u32 { self.inner @@ -181,7 +186,7 @@ impl U32Ext for u32 { pub struct CYCCNT; #[cfg(not(feature = "heterogeneous"))] -unsafe impl crate::Monotonic for CYCCNT { +impl crate::Monotonic for CYCCNT { type Instant = Instant; fn ratio() -> u32 { |
