Struct zenoh_protocol_core::NTP64
source · [−]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
sourceimpl 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
sourceimpl AddAssign<u64> for NTP64
impl AddAssign<u64> for NTP64
sourcefn add_assign(&mut self, other: u64)
fn add_assign(&mut self, other: u64)
+=
operation. Read moresourceimpl<'de> Deserialize<'de> for NTP64
impl<'de> Deserialize<'de> for NTP64
sourcefn 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>,
sourceimpl Ord for NTP64
impl Ord for NTP64
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialOrd<NTP64> for NTP64
impl PartialOrd<NTP64> for NTP64
sourcefn partial_cmp(&self, other: &NTP64) -> Option<Ordering>
fn partial_cmp(&self, other: &NTP64) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl Serialize for NTP64
impl Serialize for NTP64
sourcefn 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,
sourceimpl SubAssign<u64> for NTP64
impl SubAssign<u64> for NTP64
sourcefn sub_assign(&mut self, other: u64)
fn sub_assign(&mut self, other: u64)
-=
operation. Read more