pub struct TaiNanos(pub i128);Expand description
Continuous nanoseconds in the TAI scale.
Uses i128 to hold the full range of nanoseconds without overflow.
Promote from TaiSeconds via .into(), truncate back with
to_seconds_floor.
§Example
use leap_sec::{TaiSeconds, TaiNanos};
let ns = TaiNanos(1_700_000_037_500_000_000);
assert_eq!(format!("{ns}"), "1700000037500000000 TAI");
let promoted: TaiNanos = TaiSeconds(1_700_000_037).into();
assert_eq!(promoted, TaiNanos(1_700_000_037_000_000_000));Tuple Fields§
§0: i128Implementations§
Source§impl TaiNanos
impl TaiNanos
Sourcepub const fn to_seconds_floor(self) -> TaiSeconds
pub const fn to_seconds_floor(self) -> TaiSeconds
Truncate to whole seconds, rounding toward negative infinity.
§Example
use leap_sec::{TaiSeconds, TaiNanos};
let ns = TaiNanos(1_700_000_037_500_000_000);
assert_eq!(ns.to_seconds_floor(), TaiSeconds(1_700_000_037));Trait Implementations§
Source§impl From<TaiSeconds> for TaiNanos
Lossless promotion: multiplies by 1,000,000,000.
impl From<TaiSeconds> for TaiNanos
Lossless promotion: multiplies by 1,000,000,000.
Source§fn from(s: TaiSeconds) -> Self
fn from(s: TaiSeconds) -> Self
Converts to this type from the input type.
Source§impl Ord for TaiNanos
impl Ord for TaiNanos
Source§impl PartialOrd for TaiNanos
impl PartialOrd for TaiNanos
impl Copy for TaiNanos
impl Eq for TaiNanos
impl StructuralPartialEq for TaiNanos
Auto Trait Implementations§
impl Freeze for TaiNanos
impl RefUnwindSafe for TaiNanos
impl Send for TaiNanos
impl Sync for TaiNanos
impl Unpin for TaiNanos
impl UnsafeUnpin for TaiNanos
impl UnwindSafe for TaiNanos
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