Struct UnixTime

pub struct UnixTime(/* private field */);

A timestamp, tracking the number of non-leap seconds since the Unix epoch.

The Unix epoch is defined January 1, 1970 00:00:00 UTC.

Implementations

impl UnixTime

fn now() -> Self

The current time, as a UnixTime

const fn since_unix_epoch(duration: Duration) -> Self

Convert a Duration since the start of 1970 to a UnixTime

The duration must be relative to the Unix epoch.

const fn as_secs(&self) -> u64

Number of seconds since the Unix epoch

Trait Implementations

impl Clone for UnixTime

fn clone(&self) -> UnixTime

impl Copy for UnixTime

impl Debug for UnixTime

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for UnixTime

impl Hash for UnixTime

fn hash<__H: Hasher>(&self, state: &mut __H)

impl Ord for UnixTime

fn cmp(&self, other: &UnixTime) -> Ordering

impl PartialEq for UnixTime

fn eq(&self, other: &UnixTime) -> bool

impl PartialOrd for UnixTime

fn partial_cmp(&self, other: &UnixTime) -> Option<Ordering>

impl StructuralPartialEq for UnixTime

Auto Trait Implementations

impl Freeze for UnixTime

impl RefUnwindSafe for UnixTime

impl Send for UnixTime

impl Sync for UnixTime

impl Unpin for UnixTime

impl UnsafeUnpin for UnixTime

impl UnwindSafe for UnixTime

Blanket Implementations

impl<T> Any for UnixTime where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for UnixTime where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for UnixTime where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for UnixTime where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for UnixTime

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for UnixTime where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for UnixTime where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for UnixTime where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for UnixTime where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>