pub struct Timestamp(/* private fields */);Expand description
Milliseconds since the Unix epoch, UTC, with no leap seconds: the
ECMAScript Date time value.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_unix_millis(millis: i64) -> Self
pub const fn from_unix_millis(millis: i64) -> Self
A time millis milliseconds after the Unix epoch. Any value is
representable; Timestamp::is_portable says whether the contract
accepts it.
Sourcepub const fn unix_millis(self) -> i64
pub const fn unix_millis(self) -> i64
Milliseconds since the Unix epoch.
Sourcepub const fn is_portable(self) -> bool
pub const fn is_portable(self) -> bool
Whether the time is inside the ECMAScript Date range.
Sourcepub fn from_system_time(time: SystemTime) -> Self
pub fn from_system_time(time: SystemTime) -> Self
Truncates time to whole milliseconds (toward the past), saturating at
the i64 range.
Sourcepub fn to_iso_string(self) -> Result<String, Error>
pub fn to_iso_string(self) -> Result<String, Error>
The Date.prototype.toISOString() form, for example
2026-09-01T12:00:00.000Z; years outside 0000..9999 use the signed
six-digit form. A time outside the portable range is invalid.
Trait Implementations§
impl Copy for Timestamp
impl Eq for Timestamp
Source§impl From<SystemTime> for Timestamp
impl From<SystemTime> for Timestamp
Source§fn from(time: SystemTime) -> Self
fn from(time: SystemTime) -> Self
Converts to this type from the input type.
Source§impl Ord for Timestamp
impl Ord for Timestamp
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 PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Forget for Timestamp
impl Freeze for Timestamp
impl Move for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.