pub struct Timestamp { /* private fields */ }
Expand description
Timestamp for use with v1
algorithm.
Implementations
sourceimpl Timestamp
impl Timestamp
sourcepub const fn from_parts(ticks: u64, counter: u16) -> Self
pub const fn from_parts(ticks: u64, counter: u16) -> Self
Creates timestamp from raw parts, as per RFC4122.
ticks
is number of 100-nanoseconds intervals elapsed since 15 Oct 1582 00:00:00.00.counter
is value used to differentiate between timestamps generated to avoid collision in case of rapid generation.
sourcepub const fn from_unix(time: Duration) -> Self
pub const fn from_unix(time: Duration) -> Self
Creates instance from unix timestamp, namely it takes seconds and subsec_nanos.
Note it doesn’t set counter, if needed it must be set manually
sourcepub fn now() -> Self
pub fn now() -> Self
Creates instance using current time, namely calculating duration since epoch.
Note it doesn’t set counter, if needed it must be set manually
Only available when std
feature is enabled.
sourcepub const fn set_counter(self, counter: u16) -> Self
pub const fn set_counter(self, counter: u16) -> Self
Sets counter to further avoid chance of collision between timestamps.
Useful if clock is not guaranteed to be monotonically increasing. Otherwise there is no benefit in setting the counter.
sourcepub const fn into_parts(self) -> (u64, u16)
pub const fn into_parts(self) -> (u64, u16)
Retrieves timestamp as raw parts
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more