pub struct Timestamp(/* private fields */);
Expand description
A timestamp in nanoseconds in the UTC timezone.
Use this type for internal timestamps and for nice date formatting
use DateTime<Local>
.
The dates that can be represented as nanoseconds are between 1677-09-21T00:12:43.145224192 and 2262-04-11T23:47:16.854775807.
Implementations§
Source§impl Timestamp
impl Timestamp
pub const fn zero() -> Self
pub const fn as_secs(&self) -> i64
pub const fn as_millis(&self) -> i64
pub const fn as_micros(&self) -> i64
pub const fn as_nanos(&self) -> i64
pub fn local(&self) -> DateTime<Local>
pub fn utc(&self) -> DateTime<Utc>
pub const fn from_hours(hours: i64) -> Self
pub const fn from_minutes(minutes: i64) -> Self
pub const fn from_secs(secs: i64) -> Self
pub const fn from_millis(millis: i64) -> Self
pub const fn from_micros(micros: i64) -> Self
pub const fn from_nanos(nanos: i64) -> Self
Trait Implementations§
Source§impl Add<TimestampDelta> for Timestamp
impl Add<TimestampDelta> for Timestamp
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialOrd for Timestamp
impl PartialOrd 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
Mutably borrows from an owned value. Read more