Struct byztime::Timestamp[][src]

pub struct Timestamp(pub byztime_stamp);

A timestamp with nanosecond resolution

Implementations

impl Timestamp[src]

pub fn new(seconds: i64, nanoseconds: i64) -> Timestamp[src]

Build a timestamp from a given count of seconds and nanoseconds

pub fn seconds(self) -> i64[src]

Return the seconds portion of the timestamp

pub fn nanoseconds(self) -> i64[src]

Return the nanoseconds portion of the timestamp

pub fn normalize(self) -> Timestamp[src]

Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000.

pub fn overflowing_normalize(self) -> (Timestamp, bool)[src]

Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000.

Returns a tuple of the normalized timestamp along with a boolean indicating whether an arithmetic overflow occurred. If an overflow did occur then the 2s-complement wrapped value is returned.

pub fn wrapping_normalize(self) -> Timestamp[src]

Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000. If an overflow occurs, returns the 2s-complement wrapped value.

pub fn saturating_normalize(self) -> Timestamp[src]

Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000.

pub fn checked_normalize(self) -> Option<Timestamp>[src]

Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000, returning None if overflow occurred.

pub fn local_time() -> Result<Timestamp>[src]

Return a timestamp representing the current local time

“Local” here is in the Byztime sense of local to this machine, not the civil sense of local to a timezone.

pub fn real_time() -> Result<Timestamp>[src]

Return a timestamp representing the current real time, i.e., POSIX time

pub fn overflowing_add(self, rhs: Timestamp) -> (Timestamp, bool)[src]

Calculates self + rhs.

Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow occurred. If an overflow occurred then the wrapped value is returned.

pub fn overflowing_sub(self, rhs: Timestamp) -> (Timestamp, bool)[src]

Calculates self - rhs.

Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow occurred. If an overflow occurred then the wrapped value is returned.

pub fn checked_add(self, rhs: Timestamp) -> Option<Timestamp>[src]

Checked addition of timestamps. Computes self + rhs, returning None if overflow occurred.

pub fn checked_sub(self, rhs: Timestamp) -> Option<Timestamp>[src]

Checked subtractions of timestamps. Computes self - rhs, returning None if overflow occurred.

pub fn wrapping_add(self, rhs: Timestamp) -> Timestamp[src]

Wrapping addition of timestamps. Computess self + rhs, wrapping around at the boundary of the type.

pub fn wrapping_sub(self, rhs: Timestamp) -> Timestamp[src]

Wrapping subtraction of timestamps. Computess self - rhs, wrapping around at the boundary of the type.

pub fn saturating_add(self, rhs: Timestamp) -> Timestamp[src]

Saturating addition of timestamps. Computes self + rhs, saturating at numeric bounds instead of overflowing.

pub fn saturating_sub(self, rhs: Timestamp) -> Timestamp[src]

Saturating subtraction of timestamps. Computes self - rhs, saturating at numeric bounds instead of overflowing.

pub fn overflowing_scale(self, ppb: i64) -> (Timestamp, bool)[src]

Multiplies the timestamp by ppb parts per billion.

Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow occurred. If an overflow occurred then the wrapped value is returned.

pub fn scale(self, ppb: i64) -> Timestamp[src]

Multiplies the timestamp by ppb parts per billion.

pub fn checked_scale(self, ppb: i64) -> Option<Timestamp>[src]

Multiplies the timestamp by ppb parts per billion, returning None if overflow occurred.

pub fn wrapping_scale(self, ppb: i64) -> Timestamp[src]

Multiplies the timestamp by ppb parts per billion, wrapping around at the limits of the type if overflow occurs.

pub fn saturating_scale(self, ppb: i64) -> Timestamp[src]

Multiplies the timestamp by ppb parts per billion, saturating at numeric bounds rather than overflowing.

pub fn halve(self) -> Timestamp[src]

Divides the timestamp by two.

pub fn min_value() -> Timestamp[src]

Returns the smallest (most negative) value representable by this type.

pub fn max_value() -> Timestamp[src]

Returns the largest value representable by this type.

pub fn max_error() -> Timestamp[src]

Returns half of the largest value representable by this type. This value is used as an error term when the clock is unsynchronized.

Trait Implementations

impl Add<Timestamp> for Timestamp[src]

type Output = Timestamp

The resulting type after applying the + operator.

impl AddAssign<Timestamp> for Timestamp[src]

impl Clone for Timestamp[src]

impl Copy for Timestamp[src]

impl Debug for Timestamp[src]

impl Default for Timestamp[src]

impl Display for Timestamp[src]

impl Eq for Timestamp[src]

impl Ord for Timestamp[src]

impl PartialEq<Timestamp> for Timestamp[src]

impl PartialOrd<Timestamp> for Timestamp[src]

impl Sub<Timestamp> for Timestamp[src]

type Output = Timestamp

The resulting type after applying the - operator.

impl SubAssign<Timestamp> for Timestamp[src]

Auto Trait Implementations

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.