pub struct LeapTable<'a> { /* private fields */ }Expand description
Borrowed, validated UTC corrections for [start, end) POSIX labels.
The caller asserts that every correction in this interval is listed. Empty entries therefore mean no corrections inside the interval only. The table authenticates no source and makes no prediction outside it.
Implementations§
Source§impl<'a> LeapTable<'a>
impl<'a> LeapTable<'a>
Sourcepub fn new(
start: i64,
end: i64,
transitions: &'a [Transition],
) -> Result<Self, InvalidTable>
pub fn new( start: i64, end: i64, transitions: &'a [Transition], ) -> Result<Self, InvalidTable>
Validate the complete table once, without copying its entries.
A transition at end is included because it changes the preceding day.
Sourcepub const fn transitions(&self) -> &'a [Transition]
pub const fn transitions(&self) -> &'a [Transition]
The exact borrowed correction entries used by this calculation.
Sourcepub fn shift(&self, at: Instant, nanos: i128) -> Result<Instant, Uncertainty>
pub fn shift(&self, at: Instant, nanos: i128) -> Result<Instant, Uncertainty>
Move by elapsed nanoseconds, including inserted and deleted seconds. Both endpoints must be covered; since coverage is contiguous, the whole intervening interval is then covered as well.
RFC 3161 §2.4.2 specifies subtracting/adding accuracy to genTime:
https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2. The supplied
coverage and explicit uncertainty are API decisions, not RFC mandates.