pub struct UnixTimeStamp(/* private fields */);
Expand description
Default value is 1970-01-01 00:00:00 UTC.
UnixTimeStamp stores number of seconds elapsed since 1970-01-01 00:00:00 UTC
as u32
.
Implementations§
Source§impl UnixTimeStamp
impl UnixTimeStamp
pub fn new(system_time: SystemTime) -> Result<UnixTimeStamp, UnixTimeStampError>
Sourcepub const fn unix_epoch() -> UnixTimeStamp
pub const fn unix_epoch() -> UnixTimeStamp
Return unix epoch, same as UnixTimeStamp::default
Sourcepub fn from_raw(elapsed: u32) -> Option<UnixTimeStamp>
pub fn from_raw(elapsed: u32) -> Option<UnixTimeStamp>
Return None
if std::time::SystemTime
cannot hold the timestamp.
pub fn into_raw(self) -> u32
pub fn as_duration(self) -> Duration
pub fn as_system_time(self) -> SystemTime
Trait Implementations§
Source§impl Clone for UnixTimeStamp
impl Clone for UnixTimeStamp
Source§fn clone(&self) -> UnixTimeStamp
fn clone(&self) -> UnixTimeStamp
Returns a copy 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 UnixTimeStamp
impl Debug for UnixTimeStamp
Source§impl Default for UnixTimeStamp
impl Default for UnixTimeStamp
Source§fn default() -> UnixTimeStamp
fn default() -> UnixTimeStamp
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for UnixTimeStamp
impl<'de> Deserialize<'de> for UnixTimeStamp
Source§fn deserialize<D>(
deserializer: D,
) -> Result<UnixTimeStamp, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<UnixTimeStamp, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for UnixTimeStamp
impl Hash for UnixTimeStamp
Source§impl PartialEq for UnixTimeStamp
impl PartialEq for UnixTimeStamp
impl Copy for UnixTimeStamp
impl Eq for UnixTimeStamp
impl StructuralPartialEq for UnixTimeStamp
Auto Trait Implementations§
impl Freeze for UnixTimeStamp
impl RefUnwindSafe for UnixTimeStamp
impl Send for UnixTimeStamp
impl Sync for UnixTimeStamp
impl Unpin for UnixTimeStamp
impl UnwindSafe for UnixTimeStamp
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)