OffsetTime

Struct OffsetTime 

Source
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>

Source

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.

Source

pub fn as_pseudo_nanos_since_posix_epoch(&self) -> i128

Return the number of pseudo-nanoseconds between this time and the POSIX epoch

Source

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.

Source

pub fn sigil(&self) -> &Sig

Return the sigil associated with this leap second type

Trait Implementations§

Source§

impl<Sig: Sigil> CalendarTime for OffsetTime<Sig>

Source§

fn read(&self) -> Result<TimeResult>

Find the possible times this written time could be about
Source§

impl<Sig: Clone> Clone for OffsetTime<Sig>

Source§

fn clone(&self) -> OffsetTime<Sig>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Sig: Display> Debug for OffsetTime<Sig>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Sig: Display> Display for OffsetTime<Sig>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Sig: FromStr> FromStr for OffsetTime<Sig>

Source§

type Err = ParseError<<Sig as FromStr>::Err>

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<Sig: PartialEq> PartialEq for OffsetTime<Sig>

Source§

fn eq(&self, other: &OffsetTime<Sig>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Sig: Copy> Copy for OffsetTime<Sig>

Source§

impl<Sig: Eq> Eq for OffsetTime<Sig>

Source§

impl<Sig> StructuralPartialEq for OffsetTime<Sig>

Auto Trait Implementations§

§

impl<Sig> Freeze for OffsetTime<Sig>
where Sig: Freeze,

§

impl<Sig> RefUnwindSafe for OffsetTime<Sig>
where Sig: RefUnwindSafe,

§

impl<Sig> Send for OffsetTime<Sig>
where Sig: Send,

§

impl<Sig> Sync for OffsetTime<Sig>
where Sig: Sync,

§

impl<Sig> Unpin for OffsetTime<Sig>
where Sig: Unpin,

§

impl<Sig> UnwindSafe for OffsetTime<Sig>
where Sig: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.