pub struct NTP64(pub u64);
Expand description
A NTP 64-bits format as specified in RFC-5909
The first 32-bits part is the number of second since the EPOCH of the physical clock,
and the second 32-bits part is the fraction of second.
In case it’s part of a crate::Timestamp
generated by an crate::HLC
the last few bits are replaced
by the HLC logical counter. The size of this counter currently hard-coded in crate::CSIZE
.
Note that this timestamp in actually similar to a std::time::Duration
, as it doesn’t
define an EPOCH. Only the NTP64::to_system_time()
and std::fmt::Display::fmt()
operations assume that
it’s relative to UNIX_EPOCH (1st Jan 1970) to display the timpestamp in RFC-3339 format.
Tuple Fields§
§0: u64
Implementations§
source§impl NTP64
impl NTP64
sourcepub fn subsec_nanos(&self) -> u32
pub fn subsec_nanos(&self) -> u32
Returns the 32-bits fraction of second part converted to nanoseconds.
sourcepub fn to_duration(self) -> Duration
pub fn to_duration(self) -> Duration
Convert to a Duration
.
sourcepub fn to_system_time(self) -> SystemTime
pub fn to_system_time(self) -> SystemTime
Convert to a SystemTime
(making the assumption that this NTP64 is relative to UNIX_EPOCH
).
Trait Implementations§
source§impl AddAssign<u64> for NTP64
impl AddAssign<u64> for NTP64
source§fn add_assign(&mut self, other: u64)
fn add_assign(&mut self, other: u64)
+=
operation. Read moresource§impl<'de> Deserialize<'de> for NTP64
impl<'de> Deserialize<'de> for NTP64
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<NTP64, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<NTP64, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl Ord for NTP64
impl Ord for NTP64
source§impl PartialEq<NTP64> for NTP64
impl PartialEq<NTP64> for NTP64
source§impl PartialOrd<NTP64> for NTP64
impl PartialOrd<NTP64> for NTP64
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for NTP64
impl Serialize for NTP64
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
source§impl SubAssign<u64> for NTP64
impl SubAssign<u64> for NTP64
source§fn sub_assign(&mut self, other: u64)
fn sub_assign(&mut self, other: u64)
-=
operation. Read moreimpl Copy for NTP64
impl Eq for NTP64
impl StructuralEq for NTP64
impl StructuralPartialEq for NTP64
Auto Trait Implementations§
impl RefUnwindSafe for NTP64
impl Send for NTP64
impl Sync for NTP64
impl Unpin for NTP64
impl UnwindSafe for NTP64
Blanket Implementations§
§impl<T> AsNodeMut<T> for T
impl<T> AsNodeMut<T> for T
fn as_node_mut(&mut self) -> &mut T
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.