pub struct Time128 { /* private fields */ }Expand description
128 Bit Fixed Precision Time Format, storing 64 bits of Seconds, and 64 bits
of Fractional Seconds. This is the equivalent of Q64.64, and is semantically
equivalent to the NTP Datestamp Format if using the epoch::NTP_EPOCH.
The 64-bit seconds field can resolve 584 million years, and the 64-bit fractional field can resolve down to 54 zepto-seconds (5.4e-20).
580 million years ago, multicellular life started. 580 million years from, now, the average temperature of the Earth will be 25C higher - 40C.
The raw value is 128 bits wide, if you take the middle 64 bits, this is
identical to a Time64 - (lower 32 of seconds, upper 32 of
fractional_seconds).
Implementations§
Source§impl Time128
impl Time128
pub const fn new(epoch: Epoch, seconds: u64, fractional_seconds: u64) -> Self
pub fn new_f64(epoch: Epoch, seconds: f64) -> Self
pub const fn get_seconds(&self) -> u64
pub const fn get_fractional_seconds(&self) -> u64
pub fn as_f64(&self) -> f64
pub fn try_from_iso8601(val: &str) -> Result<Self, FormatError>
pub fn as_only_seconds(&self) -> Self
pub fn as_only_fractional(&self) -> Self
pub fn as_epoch(&self, other: Epoch) -> Self
Methods from Deref<Target = FixedU128>§
pub const E: FixedU128
pub const PI: FixedU128
pub const ONE_HALF: FixedU128
pub const RESOLUTION: FixedU128
pub fn trunc(&self) -> u64
pub fn whole(&self) -> u64
pub fn fract(&self) -> u64
pub fn raw_value(&self) -> u128
pub fn as_f64(&self) -> f64
pub fn is_zero(&self) -> bool
Trait Implementations§
Source§impl AddAssign<Duration> for &mut Time128
impl AddAssign<Duration> for &mut Time128
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreSource§impl AddAssign<Duration> for Time128
impl AddAssign<Duration> for Time128
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreSource§impl From<&UTCDateTime> for Time128
impl From<&UTCDateTime> for Time128
Source§fn from(value: &UTCDateTime) -> Self
fn from(value: &UTCDateTime) -> Self
Converts to this type from the input type.
Source§impl From<&mut UTCDateTime> for Time128
impl From<&mut UTCDateTime> for Time128
Source§fn from(value: &mut UTCDateTime) -> Self
fn from(value: &mut UTCDateTime) -> Self
Converts to this type from the input type.
Source§impl From<UTCDateTime> for Time128
impl From<UTCDateTime> for Time128
Source§fn from(value: UTCDateTime) -> Self
fn from(value: UTCDateTime) -> Self
Converts to this type from the input type.
Source§impl Ord for Time128
impl Ord for Time128
Source§impl PartialOrd for Time128
impl PartialOrd for Time128
impl Copy for Time128
impl Eq for Time128
Auto Trait Implementations§
impl Freeze for Time128
impl RefUnwindSafe for Time128
impl Send for Time128
impl Sync for Time128
impl Unpin for Time128
impl UnwindSafe for Time128
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more