[][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() -> Self[src]

Get TAI64N timestamp according to system clock.

pub fn from_slice(slice: &[u8]) -> Result<Self, 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: &Self) -> 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 From<TAI64N> for TAI64[src]

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

Remove the nanosecond component from a TAI64N value

impl From<TAI64> for TAI64N[src]

fn from(other: TAI64) -> Self[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 Sub<Duration> for TAI64N[src]

type Output = Self

The resulting type after applying the - operator.

impl PartialEq<TAI64N> for TAI64N[src]

impl Eq for TAI64N[src]

impl Ord for TAI64N[src]

impl PartialOrd<TAI64N> 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<Self, Error>[src]

Parse TAI64 from external representation

impl<'a> TryFrom<&'a [u8]> for TAI64N[src]

type Error = Error

The type returned in the event of a conversion error.

impl Add<Duration> for TAI64N[src]

type Output = Self

The resulting type after applying the + operator.

impl Hash for TAI64N[src]

impl Copy for TAI64N[src]

impl Clone for TAI64N[src]

impl Serialize for TAI64N[src]

impl<'de> Deserialize<'de> for TAI64N[src]

Auto Trait Implementations

impl Unpin for TAI64N

impl Send for TAI64N

impl Sync for TAI64N

impl UnwindSafe for TAI64N

impl RefUnwindSafe 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.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]