pub struct UtcInstant { /* private fields */ }Expand description
A UTC instant, as microseconds since 1970-01-01T00:00:00Z.
Implementations§
Source§impl UtcInstant
impl UtcInstant
Sourcepub const J2000: UtcInstant
pub const J2000: UtcInstant
2000-01-01T12:00:00Z.
Sourcepub fn from_micros(micros: i64) -> Self
pub fn from_micros(micros: i64) -> Self
From microseconds since the Unix epoch.
Sourcepub fn from_civil(
year: i32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: u32,
microsecond: u32,
) -> Self
pub fn from_civil( year: i32, month: u32, day: u32, hour: u32, minute: u32, second: u32, microsecond: u32, ) -> Self
From proleptic-Gregorian calendar fields (UTC).
Sourcepub fn civil(&self) -> (i32, u32, u32, u32, u32, u32, u32)
pub fn civil(&self) -> (i32, u32, u32, u32, u32, u32, u32)
(year, month, day, hour, minute, second, microsecond)
Sourcepub fn julian_day(&self) -> f64
pub fn julian_day(&self) -> f64
Julian day as the reference computes it from calendar fields.
Sourcepub fn seconds_since(&self, other: &UtcInstant) -> f64
pub fn seconds_since(&self, other: &UtcInstant) -> f64
Seconds from other to self, like Python (self - other).total_seconds().
Sourcepub fn add_micros(&self, micros: i64) -> Self
pub fn add_micros(&self, micros: i64) -> Self
micros microseconds later (earlier if negative).
Sourcepub fn plus_days(&self, days: f64) -> Self
pub fn plus_days(&self, days: f64) -> Self
self + timedelta(days=days), with CPython’s rounding of float days to
microseconds (whole days exact, fraction rounded half to even).
Sourcepub fn with_time(
&self,
hour: u32,
minute: u32,
second: u32,
microsecond: u32,
) -> Self
pub fn with_time( &self, hour: u32, minute: u32, second: u32, microsecond: u32, ) -> Self
Same day at another time of day (Python dt.replace(hour=…, minute=…)).
Sourcepub fn parse(text: &str) -> Result<Self, ParseError>
pub fn parse(text: &str) -> Result<Self, ParseError>
Parse YYYY-MM-DDTHH:MM[:SS[.ffffff]] with an optional Z or +00:00 suffix.
Trait Implementations§
Source§impl Clone for UtcInstant
impl Clone for UtcInstant
impl Copy for UtcInstant
Source§impl Debug for UtcInstant
impl Debug for UtcInstant
Source§impl Display for UtcInstant
impl Display for UtcInstant
impl Eq for UtcInstant
Source§impl Hash for UtcInstant
impl Hash for UtcInstant
Source§impl Ord for UtcInstant
impl Ord for UtcInstant
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for UtcInstant
impl PartialEq for UtcInstant
Source§impl PartialOrd for UtcInstant
impl PartialOrd for UtcInstant
impl StructuralPartialEq for UtcInstant
Auto Trait Implementations§
impl Freeze for UtcInstant
impl RefUnwindSafe for UtcInstant
impl Send for UtcInstant
impl Sync for UtcInstant
impl Unpin for UtcInstant
impl UnsafeUnpin for UtcInstant
impl UnwindSafe for UtcInstant
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.