pub struct Timestamp(/* private fields */);Expand description
An instant in UTC, serialized as an RFC 3339 string with a zero offset.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn from_unix_seconds(seconds: i64) -> Result<Self, TimestampError>
pub fn from_unix_seconds(seconds: i64) -> Result<Self, TimestampError>
The instant this many seconds after the Unix epoch.
§Errors
Returns an error when the count of seconds denotes no representable instant.
Sourcepub fn plus_seconds(self, seconds: i64) -> Result<Self, TimestampError>
pub fn plus_seconds(self, seconds: i64) -> Result<Self, TimestampError>
The instant this many seconds after this one.
Sub-second precision is kept rather than dropped: an adjustment asked to stand for a minute stands for a minute, rather than for a minute less however far into a second it happened to be made.
§Errors
Returns an error when the result is not a representable instant.
Sourcepub fn latest() -> Self
pub fn latest() -> Self
The latest instant this type writes as a string it reads back.
The last moment of the year 9999: RFC 3339 spells a year in four digits, so a later instant is written with a sign and more digits that no RFC 3339 reader accepts — and that a store ordering instants by their text would order before every earlier one. Reading what is due by this instant reads everything due at any instant this type can record.
§Panics
Never: the instant is a fixed one every chrono represents.
Trait Implementations§
impl Copy for Timestamp
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for Timestamp
Source§impl JsonSchema for Timestamp
impl JsonSchema for Timestamp
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more