aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2019-10-15 18:44:49 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2019-10-15 18:44:49 -0500
commiteef4e7bf7908d2a99c8d797d6f9d2ac3717e2b63 (patch)
tree1d2a7d49ce5443fcc06ab7cad39c7c8907789a70 /src
parent6196984d6d75be987d3dec3bf17909e3cd40c15b (diff)
downloadrtic-eef4e7bf7908d2a99c8d797d6f9d2ac3717e2b63.tar.gz
rtic-eef4e7bf7908d2a99c8d797d6f9d2ac3717e2b63.tar.zst
rtic-eef4e7bf7908d2a99c8d797d6f9d2ac3717e2b63.zip
more monotonic timer docs
covers - initialization and configuration of the timer; this is now a responsibility of the application author - correctness of `Monotonic::now()` in `#[init]` - safety of `Monotonic::reset()` closes #251
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 959c9b7b..d661c54f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -138,9 +138,21 @@ pub trait Monotonic {
fn ratio() -> Fraction;
/// Returns the current time
+ ///
+ /// # Correctness
+ ///
+ /// This function is *allowed* to return nonsensical values if called before `reset` is invoked
+ /// by the runtime. Therefore application authors should *not* call this function during the
+ /// `#[init]` phase.
fn now() -> Self::Instant;
/// Resets the counter to *zero*
+ ///
+ /// # Safety
+ ///
+ /// This function will be called *exactly once* by the RTFM runtime after `#[init]` returns and
+ /// before tasks can start; this is also the case in multi-core applications. User code must
+ /// *never* call this function.
unsafe fn reset();
/// A `Self::Instant` that represents a count of *zero*