pub struct Time<T: TimeScale> { /* private fields */ }Expand description
An instant in time in a given TimeScale, relative to J2000.
Time supports femtosecond precision, but be aware that many algorithms operating on Times
are not accurate to this level of precision.
Implementations§
Source§impl<T: TimeScale> Time<T>
impl<T: TimeScale> Time<T>
Sourcepub fn from_date_and_time(
scale: T,
date: Date,
time: TimeOfDay,
) -> Result<Self, TimeError>
pub fn from_date_and_time( scale: T, date: Date, time: TimeOfDay, ) -> Result<Self, TimeError>
Sourcepub const fn from_delta(scale: T, delta: TimeDelta) -> Self
pub const fn from_delta(scale: T, delta: TimeDelta) -> Self
Sourcepub const fn from_epoch(scale: T, epoch: Epoch) -> Self
pub const fn from_epoch(scale: T, epoch: Epoch) -> Self
Sourcepub fn from_julian_date(scale: T, julian_date: Days, epoch: Epoch) -> Self
pub fn from_julian_date(scale: T, julian_date: Days, epoch: Epoch) -> Self
Sourcepub fn from_two_part_julian_date(scale: T, jd1: Days, jd2: Days) -> Self
pub fn from_two_part_julian_date(scale: T, jd1: Days, jd2: Days) -> Self
Instantiates a Time from a two-part Julian date jd1 + jd2 in days.
Sourcepub fn builder_with_scale(scale: T) -> TimeBuilder<T>
pub fn builder_with_scale(scale: T) -> TimeBuilder<T>
Returns a TimeBuilder for constructing a new Time in the given TimeScale.
Sourcepub fn with_scale<S: TimeScale>(&self, scale: S) -> Time<S>
pub fn with_scale<S: TimeScale>(&self, scale: S) -> Time<S>
Returns a new Time with the delta of self but time scale scale.
Note that the underlying delta is simply copied – no time scale transformation takes place.
Sourcepub fn try_to_scale<S, P>(
&self,
scale: S,
provider: &P,
) -> Result<Time<S>, P::Error>
pub fn try_to_scale<S, P>( &self, scale: S, provider: &P, ) -> Result<Time<S>, P::Error>
Converts this time to scale using the given offset provider.
Sourcepub fn to_scale<S>(&self, scale: S) -> Time<S>
pub fn to_scale<S>(&self, scale: S) -> Time<S>
Converts this time to scale using the default offset provider.
Sourcepub fn with_scale_and_delta<S: TimeScale>(
&self,
scale: S,
delta: TimeDelta,
) -> Time<S>
pub fn with_scale_and_delta<S: TimeScale>( &self, scale: S, delta: TimeDelta, ) -> Time<S>
Returns a new Time with the delta of self adjusted by delta, and time scale scale.
Note that no time scale transformation takes place beyond the adjustment specified by
delta.
Sourcepub fn as_seconds_and_subsecond(&self) -> Option<(i64, Subsecond)>
pub fn as_seconds_and_subsecond(&self) -> Option<(i64, Subsecond)>
Returns the seconds and subsecond components, or None if the delta is non-finite.
Trait Implementations§
Source§impl<T: TimeScale> CalendarDate for Time<T>
impl<T: TimeScale> CalendarDate for Time<T>
Source§impl<T: TimeScale> CivilTime for Time<T>
impl<T: TimeScale> CivilTime for Time<T>
Source§fn as_seconds_f64(&self) -> f64
fn as_seconds_f64(&self) -> f64
f64.Source§fn millisecond(&self) -> u32
fn millisecond(&self) -> u32
Source§fn microsecond(&self) -> u32
fn microsecond(&self) -> u32
Source§fn nanosecond(&self) -> u32
fn nanosecond(&self) -> u32
Source§fn picosecond(&self) -> u32
fn picosecond(&self) -> u32
Source§fn femtosecond(&self) -> u32
fn femtosecond(&self) -> u32
Source§impl<T: TimeScale> JulianDate for Time<T>
impl<T: TimeScale> JulianDate for Time<T>
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
f64.Source§fn seconds_since_modified_julian_epoch(&self) -> f64
fn seconds_since_modified_julian_epoch(&self) -> f64
f64.Source§fn seconds_since_j1950(&self) -> f64
fn seconds_since_j1950(&self) -> f64
f64.Source§fn seconds_since_j2000(&self) -> f64
fn seconds_since_j2000(&self) -> f64
f64.Source§fn days_since_julian_epoch(&self) -> f64
fn days_since_julian_epoch(&self) -> f64
f64.Source§fn days_since_modified_julian_epoch(&self) -> f64
fn days_since_modified_julian_epoch(&self) -> f64
f64.Source§fn days_since_j1950(&self) -> f64
fn days_since_j1950(&self) -> f64
f64.Source§fn days_since_j2000(&self) -> f64
fn days_since_j2000(&self) -> f64
f64.Source§fn years_since_julian_epoch(&self) -> f64
fn years_since_julian_epoch(&self) -> f64
f64.Source§fn years_since_modified_julian_epoch(&self) -> f64
fn years_since_modified_julian_epoch(&self) -> f64
f64.Source§fn years_since_j1950(&self) -> f64
fn years_since_j1950(&self) -> f64
f64.Source§fn years_since_j2000(&self) -> f64
fn years_since_j2000(&self) -> f64
f64.Source§fn centuries_since_julian_epoch(&self) -> f64
fn centuries_since_julian_epoch(&self) -> f64
f64.Source§fn centuries_since_modified_julian_epoch(&self) -> f64
fn centuries_since_modified_julian_epoch(&self) -> f64
f64.Source§fn centuries_since_j1950(&self) -> f64
fn centuries_since_j1950(&self) -> f64
f64.Source§fn centuries_since_j2000(&self) -> f64
fn centuries_since_j2000(&self) -> f64
f64.Source§impl<T: Ord + TimeScale> Ord for Time<T>
impl<T: Ord + TimeScale> Ord for Time<T>
Source§impl<T: PartialOrd + TimeScale> PartialOrd for Time<T>
impl<T: PartialOrd + TimeScale> PartialOrd for Time<T>
Source§impl<T> ToUtc for Time<T>
impl<T> ToUtc for Time<T>
Source§fn to_utc_with_provider(&self, provider: &impl LeapSecondsProvider) -> Utc
fn to_utc_with_provider(&self, provider: &impl LeapSecondsProvider) -> Utc
impl<T: Copy + TimeScale> Copy for Time<T>
impl<T: Eq + TimeScale> Eq for Time<T>
impl<T: TimeScale> StructuralPartialEq for Time<T>
Auto Trait Implementations§
impl<T> Freeze for Time<T>where
T: Freeze,
impl<T> RefUnwindSafe for Time<T>where
T: RefUnwindSafe,
impl<T> Send for Time<T>where
T: Send,
impl<T> Sync for Time<T>where
T: Sync,
impl<T> Unpin for Time<T>where
T: Unpin,
impl<T> UnsafeUnpin for Time<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Time<T>where
T: UnwindSafe,
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
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>
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>
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