Skip to main content

Utc

Struct Utc 

Source
pub struct Utc { /* private fields */ }
Expand description

Coordinated Universal Time.

Implementations§

Source§

impl Utc

Source

pub fn offset_tai(&self, provider: &impl LeapSecondsProvider) -> TimeDelta

Returns the TAI−UTC offset at this UTC instant.

Source

pub fn to_time_with_provider( &self, provider: &impl LeapSecondsProvider, ) -> Time<Tai>

Converts this UTC instant to TAI using the given leap-seconds provider.

Source

pub fn to_time(&self) -> Time<Tai>

Converts this UTC instant to TAI using the built-in leap-seconds table.

Source

pub fn to_dyn_time_with_provider( &self, provider: &impl LeapSecondsProvider, ) -> DynTime

Converts this UTC instant to a DynTime in TAI using the given provider.

Source

pub fn to_dyn_time(&self) -> DynTime

Converts this UTC instant to a DynTime in TAI using the built-in table.

Source§

impl Utc

Source

pub fn new( date: Date, time: TimeOfDay, provider: &impl LeapSecondsProvider, ) -> Result<Self, UtcError>

Creates a new Utc instance from the given Date and TimeOfDay, with leap second validation provided by the LeapSecondsProvider.

§Errors
Source

pub fn builder() -> UtcBuilder

Returns a new UtcBuilder.

Source

pub fn from_iso_with_provider<T: LeapSecondsProvider>( iso: &str, provider: &T, ) -> Result<Self, UtcError>

Constructs a new Utc instance from the given ISO 8601 string, with leap second validation provided by the LeapSecondsProvider.

§Errors
Source

pub fn from_iso(iso: &str) -> Result<Self, UtcError>

Constructs a new Utc instance from the given ISO 8601 string, with leap second validation provided by [BuiltinLeapSeconds].

Source

pub fn from_delta(delta: TimeDelta) -> Result<Self, UtcError>

Constructs a new Utc instance from a TimeDelta relative to J2000.

Note that this constructor is not leap-second aware.

Trait Implementations§

Source§

impl ApproxEq for Utc

Source§

fn approx_eq(&self, rhs: &Self, atol: f64, rtol: f64) -> ApproxEqResults

Compares self with rhs for approximate equality. Read more
Source§

impl CalendarDate for Utc

Source§

fn date(&self) -> Date

Returns the date component.
Source§

fn year(&self) -> i64

Returns the year.
Source§

fn month(&self) -> u8

Returns the month (1–12).
Source§

fn day(&self) -> u8

Returns the day of the month (1–31).
Source§

fn day_of_year(&self) -> u16

Returns the day number within the year (1–366).
Source§

impl CivilTime for Utc

Source§

fn time(&self) -> TimeOfDay

Returns the time-of-day component.
Source§

fn hour(&self) -> u8

Returns the hour (0–23).
Source§

fn minute(&self) -> u8

Returns the minute (0–59).
Source§

fn second(&self) -> u8

Returns the second (0–60, where 60 represents a leap second).
Source§

fn as_seconds_f64(&self) -> f64

Returns the second including the subsecond fraction as an f64.
Source§

fn millisecond(&self) -> u32

Returns the millisecond component (0–999).
Source§

fn microsecond(&self) -> u32

Returns the microsecond component (0–999).
Source§

fn nanosecond(&self) -> u32

Returns the nanosecond component (0–999).
Source§

fn picosecond(&self) -> u32

Returns the picosecond component (0–999).
Source§

fn femtosecond(&self) -> u32

Returns the femtosecond component (0–999).
Source§

impl Clone for Utc

Source§

fn clone(&self) -> Utc

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 Debug for Utc

Source§

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

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

impl Default for Utc

Source§

fn default() -> Utc

Returns the “default value” for a type. Read more
Source§

impl Display for Utc

Source§

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

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

impl FromStr for Utc

Source§

type Err = UtcError

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

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

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

impl JulianDate for Utc

Source§

fn julian_date(&self, epoch: Epoch, unit: Unit) -> f64

Expresses self as a Julian date in the specified Unit, relative to the given Epoch. Read more
Source§

fn two_part_julian_date(&self) -> (f64, f64)

Expresses self as a two-part Julian date in the specified Unit, relative to the given Epoch. Read more
Source§

fn seconds_since_julian_epoch(&self) -> f64

Returns the number of seconds since the Julian epoch as an f64.
Source§

fn seconds_since_modified_julian_epoch(&self) -> f64

Returns the number of seconds since the Modified Julian epoch as an f64.
Source§

fn seconds_since_j1950(&self) -> f64

Returns the number of seconds since J1950 as an f64.
Source§

fn seconds_since_j2000(&self) -> f64

Returns the number of seconds since J2000 as an f64.
Source§

fn days_since_julian_epoch(&self) -> f64

Returns the number of days since the Julian epoch as an f64.
Source§

fn days_since_modified_julian_epoch(&self) -> f64

Returns the number of days since the Modified Julian epoch as an f64.
Source§

fn days_since_j1950(&self) -> f64

Returns the number of days since J1950 as an f64.
Source§

fn days_since_j2000(&self) -> f64

Returns the number of days since J2000 as an f64.
Source§

fn years_since_julian_epoch(&self) -> f64

Returns the number of years since the Julian epoch as an f64.
Source§

fn years_since_modified_julian_epoch(&self) -> f64

Returns the number of years since the Modified Julian epoch as an f64.
Source§

fn years_since_j1950(&self) -> f64

Returns the number of years since J1950 as an f64.
Source§

fn years_since_j2000(&self) -> f64

Returns the number of years since J2000 as an f64.
Source§

fn centuries_since_julian_epoch(&self) -> f64

Returns the number of centuries since the Julian epoch as an f64.
Source§

fn centuries_since_modified_julian_epoch(&self) -> f64

Returns the number of centuries since the Modified Julian epoch as an f64.
Source§

fn centuries_since_j1950(&self) -> f64

Returns the number of centuries since J1950 as an f64.
Source§

fn centuries_since_j2000(&self) -> f64

Returns the number of centuries since J2000 as an f64.
Source§

impl Ord for Utc

Source§

fn cmp(&self, other: &Utc) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Utc

Source§

fn eq(&self, other: &Utc) -> 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 PartialOrd for Utc

Source§

fn partial_cmp(&self, other: &Utc) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl ToDelta for Utc

Source§

fn to_delta(&self) -> TimeDelta

Transforms the value into a TimeDelta.
Source§

impl ToUtc for Utc

Source§

fn to_utc_with_provider(&self, _provider: &impl LeapSecondsProvider) -> Utc

Converts to UTC using the given leap-seconds provider.
Source§

fn to_utc(&self) -> Utc

Converts to UTC using the built-in leap-seconds table.
Source§

impl Copy for Utc

Source§

impl Eq for Utc

Source§

impl StructuralPartialEq for Utc

Auto Trait Implementations§

§

impl Freeze for Utc

§

impl RefUnwindSafe for Utc

§

impl Send for Utc

§

impl Sync for Utc

§

impl Unpin for Utc

§

impl UnsafeUnpin for Utc

§

impl UnwindSafe for Utc

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.