[][src]Struct uhlc::NTP64

pub struct NTP64(pub u64);

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.

Implementations

impl NTP64[src]

pub fn as_u64(&self) -> u64[src]

Returns this NTP64 as a u64.

pub fn as_secs(&self) -> u32[src]

Returns the 32-bits seconds part.

pub fn subsec_nanos(&self) -> u32[src]

Returns the 32-bits fraction of second part converted to nanoseconds.

pub fn to_duration(&self) -> Duration[src]

Convert to a Duration.

pub fn to_system_time(&self) -> SystemTime[src]

Convert to a SystemTime (making the assumption that this NTP64 is relative to UNIX_EPOCH).

Trait Implementations

impl<'_> Add<&'_ NTP64> for NTP64[src]

type Output = <NTP64 as Add<NTP64>>::Output

The resulting type after applying the + operator.

impl<'_, '_> Add<&'_ NTP64> for &'_ NTP64[src]

type Output = <NTP64 as Add<NTP64>>::Output

The resulting type after applying the + operator.

impl Add<NTP64> for NTP64[src]

type Output = Self

The resulting type after applying the + operator.

impl<'a> Add<NTP64> for &'a NTP64[src]

type Output = <NTP64 as Add<NTP64>>::Output

The resulting type after applying the + operator.

impl Add<u64> for NTP64[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<u64> for NTP64[src]

impl Clone for NTP64[src]

impl Copy for NTP64[src]

impl Debug for NTP64[src]

impl Default for NTP64[src]

impl Display for NTP64[src]

impl Eq for NTP64[src]

impl From<Duration> for NTP64[src]

impl FromStr for NTP64[src]

type Err = ParseNTP64Error

The associated error which can be returned from parsing.

impl Ord for NTP64[src]

impl PartialEq<NTP64> for NTP64[src]

impl PartialOrd<NTP64> for NTP64[src]

impl StructuralEq for NTP64[src]

impl StructuralPartialEq for NTP64[src]

impl Sub<NTP64> for NTP64[src]

type Output = Self

The resulting type after applying the - operator.

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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,