pub struct TaiTimestamp(/* private fields */);Expand description
A point on International Atomic Time, in nanoseconds since 1970-01-01T00:00:00 TAI.
TAI never steps for a leap second, which is why PTP keeps it, and runs ahead of UTC by every
leap second since 1972. The offset between them is the one the kernel holds, which a time
service sets, so a TaiTimestamp never mixes with a Timestamp. It is written as RFC 3339’s
date and time in the zone TAI, and parses back from it.
§Examples
use t2t_core::{TaiTimestamp, Timedelta};
let synced: TaiTimestamp = "2026-09-16T07:46:12.5 TAI".parse()?;
let next = synced + Timedelta::from_millis(500);
assert_eq!(next.to_string(), "2026-09-16T07:46:13.000000000 TAI", "half a second on");Implementations§
Source§impl TaiTimestamp
impl TaiTimestamp
Sourcepub const fn checked_add(self, span: Timedelta) -> Option<Self>
pub const fn checked_add(self, span: Timedelta) -> Option<Self>
The point span later, or None past the range.
Sourcepub const fn checked_sub(self, span: Timedelta) -> Option<Self>
pub const fn checked_sub(self, span: Timedelta) -> Option<Self>
The point span earlier, or None past the range.
Sourcepub const fn checked_since(self, start: Self) -> Option<Timedelta>
pub const fn checked_since(self, start: Self) -> Option<Timedelta>
The span since start, or None past the span’s range.
Source§impl TaiTimestamp
impl TaiTimestamp
Sourcepub const fn from_nanos(nanos: i64) -> Self
pub const fn from_nanos(nanos: i64) -> Self
The point nanos nanoseconds after 1970-01-01T00:00:00 TAI.
Sourcepub const fn from_micros(micros: i64) -> Self
pub const fn from_micros(micros: i64) -> Self
The point micros microseconds after 1970-01-01T00:00:00 TAI, saturating.
Sourcepub const fn from_millis(millis: i64) -> Self
pub const fn from_millis(millis: i64) -> Self
The point millis milliseconds after 1970-01-01T00:00:00 TAI, saturating.
Sourcepub const fn from_secs(secs: i64) -> Self
pub const fn from_secs(secs: i64) -> Self
The point secs seconds after 1970-01-01T00:00:00 TAI, saturating.
Sourcepub const fn as_micros(self) -> i64
pub const fn as_micros(self) -> i64
Whole microseconds since 1970-01-01T00:00:00 TAI, rounded down.
Trait Implementations§
Source§impl Add<Timedelta> for TaiTimestamp
impl Add<Timedelta> for TaiTimestamp
Source§impl AddAssign<Timedelta> for TaiTimestamp
impl AddAssign<Timedelta> for TaiTimestamp
Source§fn add_assign(&mut self, span: Timedelta)
fn add_assign(&mut self, span: Timedelta)
+= operation. Read moreSource§impl Clone for TaiTimestamp
impl Clone for TaiTimestamp
impl Copy for TaiTimestamp
Source§impl Debug for TaiTimestamp
impl Debug for TaiTimestamp
Source§impl Default for TaiTimestamp
impl Default for TaiTimestamp
Source§impl<'de> Deserialize<'de> for TaiTimestamp
Available on crate feature serde only.
impl<'de> Deserialize<'de> for TaiTimestamp
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for TaiTimestamp
RFC 3339’s date and time, in the zone TAI: 2026-09-16T07:46:12.123456789 TAI.
impl Display for TaiTimestamp
RFC 3339’s date and time, in the zone TAI: 2026-09-16T07:46:12.123456789 TAI.
The precision chooses the fraction’s digits, and a width pads the spelling, as for a
Timestamp.
impl Eq for TaiTimestamp
Source§impl FromBytes for TaiTimestamp
Available on crate feature zerocopy only.
impl FromBytes for TaiTimestamp
zerocopy only.Source§fn ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
fn ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
Source§fn ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
fn ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
Source§fn ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: Immutable + KnownLayout,
fn ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: Immutable + KnownLayout,
&Self. Read moreSource§fn mut_from_bytes(
source: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
fn mut_from_bytes(
source: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
Source§fn mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
fn mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
Source§fn mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
fn mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
Source§fn read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>where
Self: Sized,
fn read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>where
Self: Sized,
Source§impl FromStr for TaiTimestamp
impl FromStr for TaiTimestamp
Source§impl FromZeros for TaiTimestamp
Available on crate feature zerocopy only.
impl FromZeros for TaiTimestamp
zerocopy only.Source§fn new_zeroed() -> Selfwhere
Self: Sized,
fn new_zeroed() -> Selfwhere
Self: Sized,
Self from zeroed bytes. Read moreSource§fn new_box_zeroed() -> Result<Box<Self>, AllocError>where
Self: Sized,
fn new_box_zeroed() -> Result<Box<Self>, AllocError>where
Self: Sized,
alloc only.Box<Self> from zeroed bytes. Read moreSource§fn new_vec_zeroed(len: usize) -> Result<Vec<Self>, AllocError>where
Self: Sized,
fn new_vec_zeroed(len: usize) -> Result<Vec<Self>, AllocError>where
Self: Sized,
alloc only.Vec<Self> from zeroed bytes. Read moreSource§fn extend_vec_zeroed(
v: &mut Vec<Self>,
additional: usize,
) -> Result<(), AllocError>where
Self: Sized,
fn extend_vec_zeroed(
v: &mut Vec<Self>,
additional: usize,
) -> Result<(), AllocError>where
Self: Sized,
alloc and non-no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0 only.Vec<Self> by pushing additional new items onto the end of
the vector. The new items are initialized with zeros.Source§fn insert_vec_zeroed(
v: &mut Vec<Self>,
position: usize,
additional: usize,
) -> Result<(), AllocError>where
Self: Sized,
fn insert_vec_zeroed(
v: &mut Vec<Self>,
position: usize,
additional: usize,
) -> Result<(), AllocError>where
Self: Sized,
alloc and non-no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0 only.additional new items into Vec<Self> at position. The new
items are initialized with zeros. Read moreSource§impl Hash for TaiTimestamp
impl Hash for TaiTimestamp
impl Immutable for TaiTimestamp
zerocopy only.Source§impl IntoBytes for TaiTimestamp
Available on crate feature zerocopy only.
impl IntoBytes for TaiTimestamp
zerocopy only.Source§fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
Source§fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
Source§fn write_to_prefix(
&self,
dst: &mut [u8],
) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to_prefix(
&self,
dst: &mut [u8],
) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
Source§impl JsonSchema for TaiTimestamp
Available on crate features schemars and serde only.
impl JsonSchema for TaiTimestamp
schemars and serde only.Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl KnownLayout for TaiTimestampwhere
Self: Sized,
Available on crate feature zerocopy only.
impl KnownLayout for TaiTimestampwhere
Self: Sized,
zerocopy only.Source§type PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreSource§fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreSource§impl Ord for TaiTimestamp
impl Ord for TaiTimestamp
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for TaiTimestamp
impl PartialEq for TaiTimestamp
Source§impl PartialOrd for TaiTimestamp
impl PartialOrd for TaiTimestamp
Source§impl Serialize for TaiTimestamp
Available on crate feature serde only.
impl Serialize for TaiTimestamp
serde only.impl StructuralPartialEq for TaiTimestamp
Source§impl Sub for TaiTimestamp
The span since the other point, saturating at the span’s range.
impl Sub for TaiTimestamp
The span since the other point, saturating at the span’s range.
Source§impl Sub<Timedelta> for TaiTimestamp
impl Sub<Timedelta> for TaiTimestamp
Source§impl SubAssign<Timedelta> for TaiTimestamp
impl SubAssign<Timedelta> for TaiTimestamp
Source§fn sub_assign(&mut self, span: Timedelta)
fn sub_assign(&mut self, span: Timedelta)
-= operation. Read moreSource§impl TimePoint for TaiTimestamp
impl TimePoint for TaiTimestamp
Source§impl TryFromBytes for TaiTimestampwhere
i64: TryFromBytes,
Available on crate feature zerocopy only.
impl TryFromBytes for TaiTimestampwhere
i64: TryFromBytes,
zerocopy only.