pub struct StaticLeapSecondProvider {}Expand description
Default leap second provider that uses a pre-compiled table to obtain the leap seconds. Will suffice for most non-critical applications and is useful in testing, but cannot be updated after compilation. This makes it unsuitable for long-running applications.
Trait Implementations§
Source§impl Clone for StaticLeapSecondProvider
impl Clone for StaticLeapSecondProvider
Source§fn clone(&self) -> StaticLeapSecondProvider
fn clone(&self) -> StaticLeapSecondProvider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StaticLeapSecondProvider
impl Debug for StaticLeapSecondProvider
Source§impl Default for StaticLeapSecondProvider
impl Default for StaticLeapSecondProvider
Source§fn default() -> StaticLeapSecondProvider
fn default() -> StaticLeapSecondProvider
Source§impl Hash for StaticLeapSecondProvider
impl Hash for StaticLeapSecondProvider
Source§impl LeapSecondProvider for StaticLeapSecondProvider
impl LeapSecondProvider for StaticLeapSecondProvider
Source§fn leap_seconds_on_date(&self, utc_date: Date) -> (bool, i32)
fn leap_seconds_on_date(&self, utc_date: Date) -> (bool, i32)
For the static leap seconds provider, we just use a generated jump table that maps from
days (expressed as Date, i.e., Days since 1970-01-01) to whether that day
contains a leap second and what the total leap second count is. It is sorted in reverse,
because it is more likely for users to work with dates in the present or future than in the
past.
Source§fn leap_seconds_at_time(&self, utc_time: UtcTime) -> (bool, i32)
fn leap_seconds_at_time(&self, utc_time: UtcTime) -> (bool, i32)
To determine the leap second offset applicable at a given time, we just use a generated jump table, similar to the date-to-leap-seconds conversion. Note that leap seconds are applied only after the leap second itself: during a leap second, the count is still the same as before.