pub struct Timestamp(/* private fields */);Expand description
A point in time, in milliseconds since the Unix epoch.
It counts time as JavaScript’s Date does, and serializes as a JSON number, which the browser holds exactly for any
time Date can hold.
use hypersig::Timestamp;
let new_year = Timestamp::from_millis(1_767_225_600_000);
assert_eq!(new_year.as_millis(), 1_767_225_600_000);
assert!(Timestamp::now() > Timestamp::from_millis(0));Implementations§
Trait Implementations§
impl Comparable for Timestamp
impl Copy 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
impl Eq for Timestamp
Source§impl From<SystemTime> for Timestamp
impl From<SystemTime> for Timestamp
Source§fn from(time: SystemTime) -> Self
fn from(time: SystemTime) -> Self
Rounds time down to whole milliseconds, as Math.floor would, and
saturates past i64’s range of milliseconds.
Source§impl Ord for Timestamp
impl Ord for Timestamp
1.21.0 (const: unstable) · 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 PartialOrd for Timestamp
impl PartialOrd 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 UnsafeUnpin 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