pub struct OffsetTime<Sig> { /* private fields */ }Expand description
A time on a time scale that needs to deal with leap seconds
It is represented by both pseudo_nanos,the number of nanoseconds between
the POSIX epoch and the point in time according to this time scale, and
extra_nanos, the number of (real) nanoseconds since we entered the current
leap second and pseudo_nanos froze.
Implementations§
Source§impl<Sig> OffsetTime<Sig>
impl<Sig> OffsetTime<Sig>
Sourcepub const fn from_pseudo_nanos_since_posix_epoch(
sigil: Sig,
pseudo_nanos: i128,
extra_nanos: u64,
) -> Self
pub const fn from_pseudo_nanos_since_posix_epoch( sigil: Sig, pseudo_nanos: i128, extra_nanos: u64, ) -> Self
Build a LeapSecondedTime from the number of pseudo-nanoseconds between this time
and the POSIX epoch
pseudo_nanos represent the number of nanoseconds since the POSIX epoch, and
extra_nanos the number of real-world nanoseconds that elapsed since the time at
which pseudo-nanos froze, which can be used to represent leap seconds.
Note that no attempt is made to validate that this time is actually correct for
timezone, be it due to leap seconds being invalidly set or to pseudo_nanos
requesting a time that never existed eg. due to a timezone shift. If you manually
build an OffsetTime with invalid values, you may see strange results. This
function is mostly exposed for the implementers of TimeZone themselves.
Sourcepub fn as_pseudo_nanos_since_posix_epoch(&self) -> i128
pub fn as_pseudo_nanos_since_posix_epoch(&self) -> i128
Return the number of pseudo-nanoseconds between this time and the POSIX epoch
Sourcepub fn extra_nanos(&self) -> u64
pub fn extra_nanos(&self) -> u64
Return the number of nanoseconds that elapsed since the current leap second started
Returns 0 if not currently in a leap second.
Trait Implementations§
Source§impl<Sig: Sigil> CalendarTime for OffsetTime<Sig>
impl<Sig: Sigil> CalendarTime for OffsetTime<Sig>
Source§fn read(&self) -> Result<TimeResult>
fn read(&self) -> Result<TimeResult>
Source§impl<Sig: Clone> Clone for OffsetTime<Sig>
impl<Sig: Clone> Clone for OffsetTime<Sig>
Source§fn clone(&self) -> OffsetTime<Sig>
fn clone(&self) -> OffsetTime<Sig>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more