pub struct Timestamp(_);Expand description
A timestamp
Implementations
sourceimpl Timestamp
impl Timestamp
pub const fn new(inner: OffsetDateTime) -> Self
pub const fn to_inner(self) -> OffsetDateTime
pub const fn to_utc(self) -> Self
sourcepub fn now() -> Self
pub fn now() -> Self
Current system time with offset
Tries to obtain the current system time with the local time zone offset. Returns an UTC timestamp as a fallback if the local time zone is unknown or could not be determined.
Prefer to use Self::now_utc() if the local time zone offset doesn’t
matter.
pub fn parse_rfc3339(input: &str) -> Result<Self, Parse>
pub fn format_rfc3339(&self) -> Result<String, Format>
pub fn format_rfc3339_into<W: Write>(
&self,
output: &mut W
) -> Result<usize, Format>
Methods from Deref<Target = OffsetDateTime>
pub const UNIX_EPOCH: OffsetDateTime = Date::__from_ordinal_date_unchecked(1970, 1).midnight().assume_utc()
Trait Implementations
sourceimpl AddAssign<Interval> for Timestamp
impl AddAssign<Interval> for Timestamp
sourcefn add_assign(&mut self, interval: Interval)
fn add_assign(&mut self, interval: Interval)
Performs the
+= operation. Read moresourceimpl AsRef<OffsetDateTime> for Timestamp
impl AsRef<OffsetDateTime> for Timestamp
sourcefn as_ref(&self) -> &OffsetDateTime
fn as_ref(&self) -> &OffsetDateTime
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Deref for Timestamp
impl Deref for Timestamp
type Target = OffsetDateTime
type Target = OffsetDateTime
The resulting type after dereferencing.
sourcefn deref(&self) -> &OffsetDateTime
fn deref(&self) -> &OffsetDateTime
Dereferences the value.
sourceimpl From<OffsetDateTime> for Timestamp
impl From<OffsetDateTime> for Timestamp
sourcefn from(inner: OffsetDateTime) -> Self
fn from(inner: OffsetDateTime) -> Self
Converts to this type from the input type.
sourceimpl From<SystemTime> for Timestamp
impl From<SystemTime> for Timestamp
sourcefn from(system_time: SystemTime) -> Self
fn from(system_time: SystemTime) -> Self
Converts to this type from the input type.
sourceimpl From<Timestamp> for OffsetDateTime
impl From<Timestamp> for OffsetDateTime
sourceimpl From<Timestamp> for SystemTime
impl From<Timestamp> for SystemTime
sourceimpl Ord for Timestamp
impl Ord for Timestamp
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Timestamp> for Timestamp
impl PartialOrd<Timestamp> for Timestamp
sourcefn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>
fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresourceimpl SubAssign<Interval> for Timestamp
impl SubAssign<Interval> for Timestamp
sourcefn sub_assign(&mut self, interval: Interval)
fn sub_assign(&mut self, interval: Interval)
Performs the
-= operation. Read moreimpl Copy for Timestamp
impl Eq for Timestamp
impl StructuralEq for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more