pub struct Timestamp(pub byztime_stamp);Expand description
A timestamp with nanosecond resolution
Tuple Fields§
§0: byztime_stampImplementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn new(seconds: i64, nanoseconds: i64) -> Timestamp
pub fn new(seconds: i64, nanoseconds: i64) -> Timestamp
Build a timestamp from a given count of seconds and nanoseconds
Sourcepub fn nanoseconds(self) -> i64
pub fn nanoseconds(self) -> i64
Return the nanoseconds portion of the timestamp
Sourcepub fn normalize(self) -> Timestamp
pub fn normalize(self) -> Timestamp
Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000.
Sourcepub fn overflowing_normalize(self) -> (Timestamp, bool)
pub fn overflowing_normalize(self) -> (Timestamp, bool)
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.
Sourcepub fn wrapping_normalize(self) -> Timestamp
pub fn wrapping_normalize(self) -> Timestamp
Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000. If an overflow occurs, returns the 2s-complement wrapped value.
Sourcepub fn saturating_normalize(self) -> Timestamp
pub fn saturating_normalize(self) -> Timestamp
Normalizes the timestamp such that 0 ≤ nanoseconds < 1_000_000_000.
Sourcepub fn checked_normalize(self) -> Option<Timestamp>
pub fn checked_normalize(self) -> Option<Timestamp>
Normalizes the timestamp such that 0 ≤ nanoseconds <
1_000_000_000, returning None if overflow occurred.
Sourcepub fn local_time() -> Result<Timestamp>
pub fn local_time() -> Result<Timestamp>
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.
Sourcepub fn real_time() -> Result<Timestamp>
pub fn real_time() -> Result<Timestamp>
Return a timestamp representing the current real time, i.e., POSIX time
Sourcepub fn overflowing_add(self, rhs: Timestamp) -> (Timestamp, bool)
pub fn overflowing_add(self, rhs: Timestamp) -> (Timestamp, bool)
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.
Sourcepub fn overflowing_sub(self, rhs: Timestamp) -> (Timestamp, bool)
pub fn overflowing_sub(self, rhs: Timestamp) -> (Timestamp, bool)
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.
Sourcepub fn checked_add(self, rhs: Timestamp) -> Option<Timestamp>
pub fn checked_add(self, rhs: Timestamp) -> Option<Timestamp>
Checked addition of timestamps. Computes self + rhs,
returning None if overflow occurred.
Sourcepub fn checked_sub(self, rhs: Timestamp) -> Option<Timestamp>
pub fn checked_sub(self, rhs: Timestamp) -> Option<Timestamp>
Checked subtractions of timestamps. Computes self - rhs,
returning None if overflow occurred.
Sourcepub fn wrapping_add(self, rhs: Timestamp) -> Timestamp
pub fn wrapping_add(self, rhs: Timestamp) -> Timestamp
Wrapping addition of timestamps. Computess self + rhs,
wrapping around at the boundary of the type.
Sourcepub fn wrapping_sub(self, rhs: Timestamp) -> Timestamp
pub fn wrapping_sub(self, rhs: Timestamp) -> Timestamp
Wrapping subtraction of timestamps. Computess self - rhs,
wrapping around at the boundary of the type.
Sourcepub fn saturating_add(self, rhs: Timestamp) -> Timestamp
pub fn saturating_add(self, rhs: Timestamp) -> Timestamp
Saturating addition of timestamps. Computes self + rhs,
saturating at numeric bounds instead of overflowing.
Sourcepub fn saturating_sub(self, rhs: Timestamp) -> Timestamp
pub fn saturating_sub(self, rhs: Timestamp) -> Timestamp
Saturating subtraction of timestamps. Computes self - rhs,
saturating at numeric bounds instead of overflowing.
Sourcepub fn overflowing_scale(self, ppb: i64) -> (Timestamp, bool)
pub fn overflowing_scale(self, ppb: i64) -> (Timestamp, bool)
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.
Sourcepub fn checked_scale(self, ppb: i64) -> Option<Timestamp>
pub fn checked_scale(self, ppb: i64) -> Option<Timestamp>
Multiplies the timestamp by ppb parts per billion,
returning None if overflow occurred.
Sourcepub fn wrapping_scale(self, ppb: i64) -> Timestamp
pub fn wrapping_scale(self, ppb: i64) -> Timestamp
Multiplies the timestamp by ppb parts per billion,
wrapping around at the limits of the type if overflow
occurs.
Sourcepub fn saturating_scale(self, ppb: i64) -> Timestamp
pub fn saturating_scale(self, ppb: i64) -> Timestamp
Multiplies the timestamp by ppb parts per billion,
saturating at numeric bounds rather than overflowing.
Trait Implementations§
Source§impl AddAssign for Timestamp
impl AddAssign for Timestamp
Source§fn add_assign(&mut self, other: Timestamp)
fn add_assign(&mut self, other: Timestamp)
+= operation. Read moreSource§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
Source§impl SubAssign for Timestamp
impl SubAssign for Timestamp
Source§fn sub_assign(&mut self, other: Timestamp)
fn sub_assign(&mut self, other: Timestamp)
-= operation. Read more