pub struct Timestamp(/* private fields */);Expand description
A moment on the caller’s clock, in whole microseconds.
The filter reads no clock. Every ImuSample and every measurement
carries the time it describes, and the filter differences them: the interval a step
covers, and how long ago a measurement was taken. Where the epoch sits does not matter,
since only differences are read, but IMU and measurement times must be on one clock.
Microseconds in a u64, the unit PX4’s hrt_abstime and ArduPilot’s micros64 count
in, rather than seconds in an f32: two hours in, as on 2c42096b’s 7127 s, f32 times
are 0.49 ms apart, so a difference of two can be off by a fifth of a 400 Hz IMU interval.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
From a count of microseconds.
Sourcepub fn from_secs_f64(seconds: f64) -> Self
pub fn from_secs_f64(seconds: f64) -> Self
From seconds since the epoch, rounded to the nearest microsecond. A time before the epoch, or one that is not a number, is the epoch.
f64 because a log’s time column is: an f32 would lose the microseconds this type
exists to keep.
Sourcepub fn after(self, interval: Seconds) -> Self
pub fn after(self, interval: Seconds) -> Self
The moment interval after this one, to the nearest microsecond, saturating at the
ends of the clock. A negative interval is a moment before it.
Sourcepub fn before(self, interval: Seconds) -> Self
pub fn before(self, interval: Seconds) -> Self
The moment interval before this one: a measurement’s time from its age.
Sourcepub fn since(self, earlier: Self) -> Seconds
pub fn since(self, earlier: Self) -> Seconds
self − earlier, negative when earlier is the later of the two.
The subtraction is exact, in integers, and only its result is rounded to f32, so
a short interval late in a long flight keeps every microsecond it has. The interval a
rate IMU’s reading stands for, for ImuSample::from_rates.
Trait Implementations§
impl Copy for Timestamp
impl Eq for Timestamp
Source§impl Ord for Timestamp
impl Ord for Timestamp
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.