pub struct Utc { /* private fields */ }Expand description
Coordinated Universal Time.
Implementations§
Source§impl Utc
impl Utc
Sourcepub fn offset_tai(&self, provider: &impl LeapSecondsProvider) -> TimeDelta
pub fn offset_tai(&self, provider: &impl LeapSecondsProvider) -> TimeDelta
Returns the TAI−UTC offset at this UTC instant.
Sourcepub fn to_time_with_provider(
&self,
provider: &impl LeapSecondsProvider,
) -> Time<Tai>
pub fn to_time_with_provider( &self, provider: &impl LeapSecondsProvider, ) -> Time<Tai>
Converts this UTC instant to TAI using the given leap-seconds provider.
Sourcepub fn to_time(&self) -> Time<Tai>
pub fn to_time(&self) -> Time<Tai>
Converts this UTC instant to TAI using the built-in leap-seconds table.
Sourcepub fn to_dyn_time_with_provider(
&self,
provider: &impl LeapSecondsProvider,
) -> DynTime
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.
Sourcepub fn to_dyn_time(&self) -> DynTime
pub fn to_dyn_time(&self) -> DynTime
Converts this UTC instant to a DynTime in TAI using the built-in table.
Source§impl Utc
impl Utc
Sourcepub fn new(
date: Date,
time: TimeOfDay,
provider: &impl LeapSecondsProvider,
) -> Result<Self, UtcError>
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
- UtcError::NonLeapSecondDate if
time.secondsis 60 seconds and the date is not a leap second date.
Sourcepub fn builder() -> UtcBuilder
pub fn builder() -> UtcBuilder
Returns a new UtcBuilder.
Sourcepub fn from_iso_with_provider<T: LeapSecondsProvider>(
iso: &str,
provider: &T,
) -> Result<Self, UtcError>
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
- UtcError::InvalidIsoString if the input string is not a valid ISO 8601 string.
- UtcError::DateError if the date component of the string is invalid.
- UtcError::TimeError if the time component of the string is invalid.
- UtcError::NonLeapSecondDate if the time component is 60 seconds and the date is not a leap second date.
Trait Implementations§
Source§impl CalendarDate for Utc
impl CalendarDate for Utc
Source§impl CivilTime for Utc
impl CivilTime for Utc
Source§fn as_seconds_f64(&self) -> f64
fn as_seconds_f64(&self) -> f64
Returns the second including the subsecond fraction as an
f64.Source§fn millisecond(&self) -> u32
fn millisecond(&self) -> u32
Returns the millisecond component (0–999).
Source§fn microsecond(&self) -> u32
fn microsecond(&self) -> u32
Returns the microsecond component (0–999).
Source§fn nanosecond(&self) -> u32
fn nanosecond(&self) -> u32
Returns the nanosecond component (0–999).
Source§fn picosecond(&self) -> u32
fn picosecond(&self) -> u32
Returns the picosecond component (0–999).
Source§fn femtosecond(&self) -> u32
fn femtosecond(&self) -> u32
Returns the femtosecond component (0–999).
Source§impl JulianDate for Utc
impl JulianDate for Utc
Source§fn two_part_julian_date(&self) -> (f64, f64)
fn two_part_julian_date(&self) -> (f64, f64)
Source§fn seconds_since_julian_epoch(&self) -> f64
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
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
fn seconds_since_j1950(&self) -> f64
Returns the number of seconds since J1950 as an
f64.Source§fn seconds_since_j2000(&self) -> f64
fn seconds_since_j2000(&self) -> f64
Returns the number of seconds since J2000 as an
f64.Source§fn days_since_julian_epoch(&self) -> f64
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
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
fn days_since_j1950(&self) -> f64
Returns the number of days since J1950 as an
f64.Source§fn days_since_j2000(&self) -> f64
fn days_since_j2000(&self) -> f64
Returns the number of days since J2000 as an
f64.Source§fn years_since_julian_epoch(&self) -> f64
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
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
fn years_since_j1950(&self) -> f64
Returns the number of years since J1950 as an
f64.Source§fn years_since_j2000(&self) -> f64
fn years_since_j2000(&self) -> f64
Returns the number of years since J2000 as an
f64.Source§fn centuries_since_julian_epoch(&self) -> f64
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
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
fn centuries_since_j1950(&self) -> f64
Returns the number of centuries since J1950 as an
f64.Source§fn centuries_since_j2000(&self) -> f64
fn centuries_since_j2000(&self) -> f64
Returns the number of centuries since J2000 as an
f64.Source§impl Ord for Utc
impl Ord for Utc
Source§impl PartialOrd for Utc
impl PartialOrd for Utc
Source§impl ToUtc for Utc
impl ToUtc for Utc
Source§fn to_utc_with_provider(&self, _provider: &impl LeapSecondsProvider) -> Utc
fn to_utc_with_provider(&self, _provider: &impl LeapSecondsProvider) -> Utc
Converts to UTC using the given leap-seconds provider.
impl Copy for Utc
impl Eq for Utc
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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