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
impl<'de> Deserialize<'de> for TaiTimestamp
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 TaiTimestampwhere
i64: FromBytes,
impl FromBytes for TaiTimestampwhere
i64: FromBytes,
§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,
§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,
§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 more§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,
§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,
§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,
§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 TaiTimestampwhere
i64: FromZeros,
impl FromZeros for TaiTimestampwhere
i64: FromZeros,
§fn new_zeroed() -> Selfwhere
Self: Sized,
fn new_zeroed() -> Selfwhere
Self: Sized,
Self from zeroed bytes. Read more§fn new_box_zeroed() -> Result<Box<Self>, AllocError>where
Self: Sized,
fn new_box_zeroed() -> Result<Box<Self>, AllocError>where
Self: Sized,
Box<Self> from zeroed bytes. Read more§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,
Vec<Self> from zeroed bytes. Read moreSource§impl Hash for TaiTimestamp
impl Hash for TaiTimestamp
impl Immutable for TaiTimestampwhere
i64: Immutable,
Source§impl IntoBytes for TaiTimestampwhere
i64: IntoBytes,
impl IntoBytes for TaiTimestampwhere
i64: IntoBytes,
§fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
§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,
§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
impl JsonSchema for TaiTimestamp
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,
impl KnownLayout for TaiTimestampwhere
Self: Sized,
Source§type PointerMetadata = ()
type PointerMetadata = ()
Self. Read more§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
impl Serialize for TaiTimestamp
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 more