Skip to main content

UtcDateTime

Struct UtcDateTime 

Source
pub struct UtcDateTime(pub Timestamp);
Expand description

An absolute instant in UTC (nanosecond-precision Unix timeline).

Tuple Fields§

§0: Timestamp

Underlying nanosecond-precision UTC instant (jiff::Timestamp).

Implementations§

Source§

impl UtcDateTime

Source

pub fn now() -> Effect<Self, Never, ()>

Current system time as UTC (Timestamp::now).

Source

pub fn from_epoch_millis(ms: i64) -> Option<Self>

Construct from Unix milliseconds when in range.

Source

pub fn unsafe_make(ms: i64) -> Self

Construct from Unix milliseconds; panics when out of range (caller assertion, not unsafe).

Source

pub fn from_std(t: SystemTime) -> Option<Self>

Convert from SystemTime (fallible on out-of-range values).

Source

pub fn inner(self) -> Timestamp

Unwrap to the raw Timestamp.

Source

pub fn to_epoch_millis(&self) -> i64

Unix time in whole milliseconds.

Source

pub fn to_zoned(self, zone: TimeZone) -> ZonedDateTime

View / project this instant into a specific IANA or fixed-offset zone.

Source

pub fn year(&self) -> i16

Civil year in UTC.

Source

pub fn month(&self) -> i8

Civil month in UTC (1–12).

Source

pub fn day(&self) -> i8

Civil day of month in UTC.

Source

pub fn hour(&self) -> i8

Civil hour in UTC (0–23).

Source

pub fn minute(&self) -> i8

Civil minute in UTC.

Source

pub fn second(&self) -> i8

Civil second in UTC.

Source

pub fn add_duration(&self, d: Duration) -> Self

Add d to this instant; panics on overflow.

Source

pub fn subtract_duration(&self, d: Duration) -> Self

Subtract d from this instant; panics on underflow.

Source

pub fn start_of(&self, unit: TimeUnit) -> Self

First instant of the unit (UTC civil calendar).

Source

pub fn end_of(&self, unit: TimeUnit) -> Self

Last representable instant inside the unit (UTC civil calendar), inclusive.

Source

pub fn nearest(&self, unit: TimeUnit) -> Self

Round to the nearest boundary of unit (UTC civil calendar).

Source

pub fn distance_millis(&self, other: &Self) -> i64

Signed difference other − self in whole milliseconds.

Source

pub fn distance_duration(&self, other: &Self) -> Duration

Absolute span between self and other as Duration.

Source

pub fn format_iso(&self) -> String

RFC 3339 / ISO-8601 instant string with Z suffix.

Source

pub fn format(&self, fmt: &str) -> String

strftime-style formatting in UTC.

Source

pub fn less_than(&self, other: &Self) -> bool

Strictly before other on the UTC timeline.

Source

pub fn greater_than(&self, other: &Self) -> bool

Strictly after other on the UTC timeline.

Source

pub fn between(&self, min: &Self, max: &Self) -> bool

Inclusive range check between min and max on the UTC timeline.

Trait Implementations§

Source§

impl Clone for UtcDateTime

Source§

fn clone(&self) -> UtcDateTime

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 UtcDateTime

Source§

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

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

impl Hash for UtcDateTime

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for UtcDateTime

Source§

fn cmp(&self, other: &UtcDateTime) -> 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 UtcDateTime

Source§

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

Source§

fn partial_cmp(&self, other: &UtcDateTime) -> 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 Copy for UtcDateTime

Source§

impl Eq for UtcDateTime

Source§

impl StructuralPartialEq for UtcDateTime

Auto Trait Implementations§

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> EffectHash for T
where T: Hash + ?Sized,

Source§

fn effect_hash(&self) -> u64

Returns a u64 hash of self using the default hasher (Effect.ts-style single-value hash).
Source§

impl<T> Equal for T
where T: PartialEq + ?Sized,

Source§

fn effect_equals(&self, other: &Self) -> bool

Returns whether self and other are structurally equal (defaults to PartialEq::eq).
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> Pipe for T

Source§

fn pipe<F, R>(self, f: F) -> R
where F: FnOnce(Self) -> R,

Applies f to self (F#-style forward pipe).
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, 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.
Source§

impl<T> EffectData for T
where T: PartialEq + Eq + Hash + ?Sized,