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 more