pub struct Timestamp { /* private fields */ }Expand description
Microsecond-precision timestamp.
Represents a point in time with microsecond precision. The reference point is hardware-dependent (typically system boot time or epoch).
§Examples
use canlink_hal::Timestamp;
let ts = Timestamp::from_micros(1_000_000);
assert_eq!(ts.as_micros(), 1_000_000);
assert_eq!(ts.as_millis(), 1_000);Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
Create a timestamp from microseconds.
§Examples
use canlink_hal::Timestamp;
let ts = Timestamp::from_micros(1_500_000);
assert_eq!(ts.as_micros(), 1_500_000);Sourcepub const fn as_micros(&self) -> u64
pub const fn as_micros(&self) -> u64
Get the timestamp as microseconds.
§Examples
use canlink_hal::Timestamp;
let ts = Timestamp::from_micros(1_500_000);
assert_eq!(ts.as_micros(), 1_500_000);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl Copy for Timestamp
impl Eq 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.