Struct ntp_proto::NtpDuration
source · pub struct NtpDuration { /* private fields */ }Expand description
NtpDuration is used to represent signed intervals between NtpTimestamps. A negative duration interval is interpreted to mean that the first timestamp used to define the interval represents a point in time after the second timestamp.
Implementations§
source§impl NtpDuration
impl NtpDuration
pub const ZERO: Self = _
sourcepub fn to_seconds(self) -> f64
pub fn to_seconds(self) -> f64
Convert to an f64; required for statistical calculations (e.g. in clock filtering)
pub fn from_seconds(seconds: f64) -> Self
sourcepub const fn as_seconds_nanos(self) -> (i32, u32)
pub const fn as_seconds_nanos(self) -> (i32, u32)
Get the number of seconds (first return value) and nanoseconds (second return value) representing the length of this duration. The number of nanoseconds is guaranteed to be positiv and less than 10^9
sourcepub fn from_exponent(input: i8) -> Self
pub fn from_exponent(input: i8) -> Self
Interpret an exponent k as 2^k seconds, expressed as an NtpDuration
pub fn from_system_duration(duration: Duration) -> Self
Trait Implementations§
source§impl Add<NtpDuration> for NtpDuration
impl Add<NtpDuration> for NtpDuration
source§impl Add<NtpDuration> for NtpTimestamp
impl Add<NtpDuration> for NtpTimestamp
§type Output = NtpTimestamp
type Output = NtpTimestamp
The resulting type after applying the
+ operator.source§impl AddAssign<NtpDuration> for NtpDuration
impl AddAssign<NtpDuration> for NtpDuration
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moresource§impl AddAssign<NtpDuration> for NtpTimestamp
impl AddAssign<NtpDuration> for NtpTimestamp
source§fn add_assign(&mut self, rhs: NtpDuration)
fn add_assign(&mut self, rhs: NtpDuration)
Performs the
+= operation. Read moresource§impl Clone for NtpDuration
impl Clone for NtpDuration
source§fn clone(&self) -> NtpDuration
fn clone(&self) -> NtpDuration
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for NtpDuration
impl Debug for NtpDuration
source§impl Default for NtpDuration
impl Default for NtpDuration
source§fn default() -> NtpDuration
fn default() -> NtpDuration
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for NtpDuration
impl<'de> Deserialize<'de> for NtpDuration
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 Div<i16> for NtpDuration
impl Div<i16> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl Div<i32> for NtpDuration
impl Div<i32> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl Div<i64> for NtpDuration
impl Div<i64> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl Div<i8> for NtpDuration
impl Div<i8> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl Div<isize> for NtpDuration
impl Div<isize> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl Div<u16> for NtpDuration
impl Div<u16> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl Div<u32> for NtpDuration
impl Div<u32> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl Div<u8> for NtpDuration
impl Div<u8> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
/ operator.source§impl DivAssign<i16> for NtpDuration
impl DivAssign<i16> for NtpDuration
source§fn div_assign(&mut self, rhs: i16)
fn div_assign(&mut self, rhs: i16)
Performs the
/= operation. Read moresource§impl DivAssign<i32> for NtpDuration
impl DivAssign<i32> for NtpDuration
source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
Performs the
/= operation. Read moresource§impl DivAssign<i64> for NtpDuration
impl DivAssign<i64> for NtpDuration
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
Performs the
/= operation. Read moresource§impl DivAssign<i8> for NtpDuration
impl DivAssign<i8> for NtpDuration
source§fn div_assign(&mut self, rhs: i8)
fn div_assign(&mut self, rhs: i8)
Performs the
/= operation. Read moresource§impl DivAssign<isize> for NtpDuration
impl DivAssign<isize> for NtpDuration
source§fn div_assign(&mut self, rhs: isize)
fn div_assign(&mut self, rhs: isize)
Performs the
/= operation. Read moresource§impl DivAssign<u16> for NtpDuration
impl DivAssign<u16> for NtpDuration
source§fn div_assign(&mut self, rhs: u16)
fn div_assign(&mut self, rhs: u16)
Performs the
/= operation. Read moresource§impl DivAssign<u32> for NtpDuration
impl DivAssign<u32> for NtpDuration
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
Performs the
/= operation. Read moresource§impl DivAssign<u8> for NtpDuration
impl DivAssign<u8> for NtpDuration
source§fn div_assign(&mut self, rhs: u8)
fn div_assign(&mut self, rhs: u8)
Performs the
/= operation. Read moresource§impl Mul<FrequencyTolerance> for NtpDuration
impl Mul<FrequencyTolerance> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<NtpDuration> for i16
impl Mul<NtpDuration> for i16
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<NtpDuration> for i32
impl Mul<NtpDuration> for i32
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<NtpDuration> for i64
impl Mul<NtpDuration> for i64
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<NtpDuration> for i8
impl Mul<NtpDuration> for i8
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<NtpDuration> for isize
impl Mul<NtpDuration> for isize
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<NtpDuration> for u16
impl Mul<NtpDuration> for u16
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<NtpDuration> for u32
impl Mul<NtpDuration> for u32
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<NtpDuration> for u8
impl Mul<NtpDuration> for u8
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§fn mul(self, rhs: NtpDuration) -> NtpDuration
fn mul(self, rhs: NtpDuration) -> NtpDuration
Performs the
* operation. Read moresource§impl Mul<i16> for NtpDuration
impl Mul<i16> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<i32> for NtpDuration
impl Mul<i32> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<i64> for NtpDuration
impl Mul<i64> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<i8> for NtpDuration
impl Mul<i8> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<isize> for NtpDuration
impl Mul<isize> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<u16> for NtpDuration
impl Mul<u16> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<u32> for NtpDuration
impl Mul<u32> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl Mul<u8> for NtpDuration
impl Mul<u8> for NtpDuration
§type Output = NtpDuration
type Output = NtpDuration
The resulting type after applying the
* operator.source§impl MulAssign<i16> for NtpDuration
impl MulAssign<i16> for NtpDuration
source§fn mul_assign(&mut self, rhs: i16)
fn mul_assign(&mut self, rhs: i16)
Performs the
*= operation. Read moresource§impl MulAssign<i32> for NtpDuration
impl MulAssign<i32> for NtpDuration
source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the
*= operation. Read moresource§impl MulAssign<i64> for NtpDuration
impl MulAssign<i64> for NtpDuration
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
Performs the
*= operation. Read moresource§impl MulAssign<i8> for NtpDuration
impl MulAssign<i8> for NtpDuration
source§fn mul_assign(&mut self, rhs: i8)
fn mul_assign(&mut self, rhs: i8)
Performs the
*= operation. Read moresource§impl MulAssign<isize> for NtpDuration
impl MulAssign<isize> for NtpDuration
source§fn mul_assign(&mut self, rhs: isize)
fn mul_assign(&mut self, rhs: isize)
Performs the
*= operation. Read moresource§impl MulAssign<u16> for NtpDuration
impl MulAssign<u16> for NtpDuration
source§fn mul_assign(&mut self, rhs: u16)
fn mul_assign(&mut self, rhs: u16)
Performs the
*= operation. Read moresource§impl MulAssign<u32> for NtpDuration
impl MulAssign<u32> for NtpDuration
source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
Performs the
*= operation. Read moresource§impl MulAssign<u8> for NtpDuration
impl MulAssign<u8> for NtpDuration
source§fn mul_assign(&mut self, rhs: u8)
fn mul_assign(&mut self, rhs: u8)
Performs the
*= operation. Read moresource§impl Neg for NtpDuration
impl Neg for NtpDuration
source§impl Ord for NtpDuration
impl Ord for NtpDuration
source§fn cmp(&self, other: &NtpDuration) -> Ordering
fn cmp(&self, other: &NtpDuration) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<NtpDuration> for NtpDuration
impl PartialEq<NtpDuration> for NtpDuration
source§fn eq(&self, other: &NtpDuration) -> bool
fn eq(&self, other: &NtpDuration) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd<NtpDuration> for NtpDuration
impl PartialOrd<NtpDuration> for NtpDuration
source§fn partial_cmp(&self, other: &NtpDuration) -> Option<Ordering>
fn partial_cmp(&self, other: &NtpDuration) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl Serialize for NtpDuration
impl Serialize for NtpDuration
source§impl Sub<NtpDuration> for NtpDuration
impl Sub<NtpDuration> for NtpDuration
source§impl Sub<NtpDuration> for NtpTimestamp
impl Sub<NtpDuration> for NtpTimestamp
§type Output = NtpTimestamp
type Output = NtpTimestamp
The resulting type after applying the
- operator.source§impl SubAssign<NtpDuration> for NtpDuration
impl SubAssign<NtpDuration> for NtpDuration
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moresource§impl SubAssign<NtpDuration> for NtpTimestamp
impl SubAssign<NtpDuration> for NtpTimestamp
source§fn sub_assign(&mut self, rhs: NtpDuration)
fn sub_assign(&mut self, rhs: NtpDuration)
Performs the
-= operation. Read moreimpl Copy for NtpDuration
impl Eq for NtpDuration
impl StructuralEq for NtpDuration
impl StructuralPartialEq for NtpDuration
Auto Trait Implementations§
impl RefUnwindSafe for NtpDuration
impl Send for NtpDuration
impl Sync for NtpDuration
impl Unpin for NtpDuration
impl UnwindSafe for NtpDuration
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