Struct byztime::Timestamp [−][src]
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.
fn add(self, other: Timestamp) -> Timestamp
[src]
impl AddAssign<Timestamp> for Timestamp
[src]
fn add_assign(&mut self, other: 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]
fn cmp(&self, other: &Timestamp) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Timestamp> for Timestamp
[src]
fn eq(&self, other: &Timestamp) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Timestamp> for Timestamp
[src]
fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Sub<Timestamp> for Timestamp
[src]
type Output = Timestamp
The resulting type after applying the -
operator.
fn sub(self, other: Timestamp) -> Timestamp
[src]
impl SubAssign<Timestamp> for Timestamp
[src]
fn sub_assign(&mut self, other: Timestamp)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,