[][src]Struct tai64::TAI64N

pub struct TAI64N(pub TAI64, pub u32);

A TAI64N timestamp.

Invariant: The nanosecond part <= 999999999.

Methods

impl TAI64N[src]

pub fn now() -> TAI64N[src]

Get TAI64N timestamp according to system clock.

pub fn from_slice(slice: &[u8]) -> Result<TAI64N, Error>[src]

Parse TAI64N from a byte slice

pub fn to_bytes(self) -> [u8; 12][src]

Serialize TAI64N as bytes

pub fn duration_since(&self, other: &TAI64N) -> Result<Duration, Duration>[src]

Calculate how much time passes since the other timestamp.

Returns Ok(Duration) if other is earlier than self, Err(Duration) otherwise.

pub fn from_system_time(t: &SystemTime) -> Self[src]

Convert SystemTime to TAI64N.

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

Convert TAI64Nto SystemTime.

pub fn from_datetime_utc(t: &DateTime<Utc>) -> Self[src]

Convert chrono::DateTime<Utc> to TAI64N

pub fn to_datetime_utc(&self) -> DateTime<Utc>[src]

Convert TAI64N to chrono::DateTime<Utc>

Trait Implementations

impl PartialEq<TAI64N> for TAI64N[src]

impl Eq for TAI64N[src]

impl Ord for TAI64N[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl PartialOrd<TAI64N> for TAI64N[src]

impl Copy for TAI64N[src]

impl From<TAI64N> for TAI64[src]

fn from(other: TAI64N) -> TAI64[src]

Remove the nanosecond component from a TAI64N value

impl From<TAI64> for TAI64N[src]

fn from(other: TAI64) -> TAI64N[src]

Remove the nanosecond component from a TAI64N value

impl From<TAI64N> for [u8; 12][src]

fn from(tai: TAI64N) -> [u8; 12][src]

Serialize TAI64 to external representation

impl From<SystemTime> for TAI64N[src]

impl From<DateTime<Utc>> for TAI64N[src]

impl Debug for TAI64N[src]

impl TryFrom<[u8; 12]> for TAI64N[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(bytes: [u8; 12]) -> Result<TAI64N, Error>[src]

Parse TAI64 from external representation

impl Add<Duration> for TAI64N[src]

type Output = TAI64N

The resulting type after applying the + operator.

impl Sub<Duration> for TAI64N[src]

type Output = TAI64N

The resulting type after applying the - operator.

impl Hash for TAI64N[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Clone for TAI64N[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for TAI64N

impl Sync for TAI64N

Blanket Implementations

impl<T> From<T> for T[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> Into<U> for T where
    U: From<T>, 
[src]

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

type Owned = T

The resulting type after obtaining ownership.