pub struct UtcDateTime(pub Timestamp);Expand description
An absolute instant in UTC (nanosecond-precision Unix timeline).
Tuple Fields§
§0: TimestampUnderlying nanosecond-precision UTC instant (jiff::Timestamp).
Implementations§
Source§impl UtcDateTime
impl UtcDateTime
Sourcepub fn from_epoch_millis(ms: i64) -> Option<Self>
pub fn from_epoch_millis(ms: i64) -> Option<Self>
Construct from Unix milliseconds when in range.
Sourcepub fn unsafe_make(ms: i64) -> Self
pub fn unsafe_make(ms: i64) -> Self
Construct from Unix milliseconds; panics when out of range (caller assertion, not unsafe).
Sourcepub fn from_std(t: SystemTime) -> Option<Self>
pub fn from_std(t: SystemTime) -> Option<Self>
Convert from SystemTime (fallible on out-of-range values).
Sourcepub fn to_epoch_millis(&self) -> i64
pub fn to_epoch_millis(&self) -> i64
Unix time in whole milliseconds.
Sourcepub fn to_zoned(self, zone: TimeZone) -> ZonedDateTime
pub fn to_zoned(self, zone: TimeZone) -> ZonedDateTime
View / project this instant into a specific IANA or fixed-offset zone.
Sourcepub fn add_duration(&self, d: Duration) -> Self
pub fn add_duration(&self, d: Duration) -> Self
Add d to this instant; panics on overflow.
Sourcepub fn subtract_duration(&self, d: Duration) -> Self
pub fn subtract_duration(&self, d: Duration) -> Self
Subtract d from this instant; panics on underflow.
Sourcepub fn end_of(&self, unit: TimeUnit) -> Self
pub fn end_of(&self, unit: TimeUnit) -> Self
Last representable instant inside the unit (UTC civil calendar), inclusive.
Sourcepub fn nearest(&self, unit: TimeUnit) -> Self
pub fn nearest(&self, unit: TimeUnit) -> Self
Round to the nearest boundary of unit (UTC civil calendar).
Sourcepub fn distance_millis(&self, other: &Self) -> i64
pub fn distance_millis(&self, other: &Self) -> i64
Signed difference other − self in whole milliseconds.
Sourcepub fn distance_duration(&self, other: &Self) -> Duration
pub fn distance_duration(&self, other: &Self) -> Duration
Absolute span between self and other as Duration.
Sourcepub fn format_iso(&self) -> String
pub fn format_iso(&self) -> String
RFC 3339 / ISO-8601 instant string with Z suffix.
Sourcepub fn greater_than(&self, other: &Self) -> bool
pub fn greater_than(&self, other: &Self) -> bool
Strictly after other on the UTC timeline.
Trait Implementations§
Source§impl Clone for UtcDateTime
impl Clone for UtcDateTime
Source§fn clone(&self) -> UtcDateTime
fn clone(&self) -> UtcDateTime
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UtcDateTime
impl Debug for UtcDateTime
Source§impl Hash for UtcDateTime
impl Hash for UtcDateTime
Source§impl Ord for UtcDateTime
impl Ord for UtcDateTime
Source§fn cmp(&self, other: &UtcDateTime) -> Ordering
fn cmp(&self, other: &UtcDateTime) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for UtcDateTime
impl PartialEq for UtcDateTime
Source§impl PartialOrd for UtcDateTime
impl PartialOrd for UtcDateTime
impl Copy for UtcDateTime
impl Eq for UtcDateTime
impl StructuralPartialEq for UtcDateTime
Auto Trait Implementations§
impl Freeze for UtcDateTime
impl RefUnwindSafe for UtcDateTime
impl Send for UtcDateTime
impl Sync for UtcDateTime
impl Unpin for UtcDateTime
impl UnsafeUnpin for UtcDateTime
impl UnwindSafe for UtcDateTime
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> EffectHash for T
impl<T> EffectHash for T
Source§fn effect_hash(&self) -> u64
fn effect_hash(&self) -> u64
u64 hash of self using the default hasher (Effect.ts-style single-value hash).Source§impl<T> Equal for T
impl<T> Equal for T
Source§fn effect_equals(&self, other: &Self) -> bool
fn effect_equals(&self, other: &Self) -> bool
self and other are structurally equal (defaults to PartialEq::eq).