pub struct NanoTimestamp(pub i64);Expand description
Exchange-epoch timestamp with nanosecond resolution.
Stores nanoseconds since the Unix epoch (UTC).
Tuple Fields§
§0: i64Implementations§
Source§impl NanoTimestamp
impl NanoTimestamp
Sourcepub fn now() -> Self
pub fn now() -> Self
Returns the current UTC time as a NanoTimestamp.
Falls back to 0 if the system clock overflows nanosecond range (extremely unlikely).
Sourcepub fn to_datetime(&self) -> DateTime<Utc>
pub fn to_datetime(&self) -> DateTime<Utc>
Converts this timestamp to a DateTime<Utc>.
Trait Implementations§
Source§impl Clone for NanoTimestamp
impl Clone for NanoTimestamp
Source§fn clone(&self) -> NanoTimestamp
fn clone(&self) -> NanoTimestamp
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NanoTimestamp
impl Debug for NanoTimestamp
Source§impl<'de> Deserialize<'de> for NanoTimestamp
impl<'de> Deserialize<'de> for NanoTimestamp
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 NanoTimestamp
impl Ord for NanoTimestamp
Source§fn cmp(&self, other: &NanoTimestamp) -> Ordering
fn cmp(&self, other: &NanoTimestamp) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for NanoTimestamp
impl PartialEq for NanoTimestamp
Source§impl PartialOrd for NanoTimestamp
impl PartialOrd for NanoTimestamp
Source§impl Serialize for NanoTimestamp
impl Serialize for NanoTimestamp
impl Copy for NanoTimestamp
impl Eq for NanoTimestamp
impl StructuralPartialEq for NanoTimestamp
Auto Trait Implementations§
impl Freeze for NanoTimestamp
impl RefUnwindSafe for NanoTimestamp
impl Send for NanoTimestamp
impl Sync for NanoTimestamp
impl Unpin for NanoTimestamp
impl UnsafeUnpin for NanoTimestamp
impl UnwindSafe for NanoTimestamp
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