pub struct Timestamp(/* private fields */);Expand description
An instant in time represented as the number of nanoseconds since the Unix epoch.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn format_http_date(self) -> String
pub fn format_http_date(self) -> String
Format the timestamp into http date: Sun, 06 Nov 1994 08:49:37 GMT
§Note
HTTP date is slightly different from RFC2822.
- Timezone is fixed to GMT.
- Day must be 2 digit.
Sourcepub fn new(second: i64, nanosecond: i32) -> Result<Self, Error>
pub fn new(second: i64, nanosecond: i32) -> Result<Self, Error>
Creates a new instant in time from the number of seconds elapsed since the Unix epoch.
When second is negative, it corresponds to an instant in time before the Unix epoch. A smaller number corresponds to an instant in time further into the past.
Sourcepub fn from_millisecond(millis: i64) -> Result<Self>
pub fn from_millisecond(millis: i64) -> Result<Self>
Creates a new instant in time from the number of milliseconds elapsed since the Unix epoch.
When millisecond is negative, it corresponds to an instant in time
before the Unix epoch. A smaller number corresponds to an instant in
time further into the past.
Sourcepub fn from_second(second: i64) -> Result<Self>
pub fn from_second(second: i64) -> Result<Self>
Creates a new instant in time from the number of seconds elapsed since the Unix epoch.
When second is negative, it corresponds to an instant in time before
the Unix epoch. A smaller number corresponds to an instant in time
further into the past.
Sourcepub fn parse_rfc2822(s: &str) -> Result<Timestamp>
pub fn parse_rfc2822(s: &str) -> Result<Timestamp>
Parse a timestamp from RFC2822.
All of them are valid time:
Sat, 13 Jul 2024 15:09:59 -0400Mon, 15 Aug 2022 16:50:12 GMT
Sourcepub fn into_inner(self) -> Timestamp
pub fn into_inner(self) -> Timestamp
Convert to inner jiff::Timestamp for compatibility.
This method is provided for accessing the underlying jiff::Timestamp
when needed for interoperability with jiff-specific APIs.
Trait Implementations§
Source§impl AddAssign<Duration> for Timestamp
impl AddAssign<Duration> for Timestamp
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+= operation. Read moreSource§impl From<Timestamp> for SystemTime
impl From<Timestamp> for SystemTime
Source§impl FromStr for Timestamp
impl FromStr for Timestamp
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
Source§impl SubAssign<Duration> for Timestamp
impl SubAssign<Duration> for Timestamp
Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-= operation. Read moreSource§impl TryFrom<SystemTime> for Timestamp
impl TryFrom<SystemTime> for Timestamp
impl Copy for Timestamp
impl Eq for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin 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
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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.