Skip to main content

UnixTimestamp

Type Alias UnixTimestamp 

Source
pub type UnixTimestamp = Timestamp<UnixEpoch>;
Expand description

Represents a duration offset from the UNIX_EPOCH.

Aliased Type§

pub struct UnixTimestamp { /* private fields */ }

Implementations§

Source§

impl UnixTimestamp

Source

pub fn now() -> UnixTimestamp

Available on crate feature std only.

Returns the local system clock equivalent of the unix timestamp

Source

pub fn elapsed(&self) -> Duration

Available on crate feature std only.

Returns the local system clock duration since the timestamp. MAY BE NEGATIVE if the clock has changed since the last call.

Source

pub fn as_date(&self) -> Date

Returns this timestamp as a Date

Source

pub fn as_julian(&self) -> JulianDate

Source§

impl UnixTimestamp

Source

pub const fn from_offset(offset: Duration) -> UnixTimestamp

Creates a new timestamp given the specified offset

Source

pub const fn from_seconds(seconds: u32) -> UnixTimestamp

Creates a new timestamp given the specified number of seconds

Source

pub const fn from_seconds_f64(seconds: f64) -> UnixTimestamp

Creates a new timestamp given the specified number of fractional seconds

Trait Implementations§

Source§

impl Default for UnixTimestamp

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for UnixTimestamp

Available on crate feature serde only.
Source§

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 From<&Date> for UnixTimestamp

Source§

fn from(value: &Date) -> Self

Converts to this type from the input type.
Source§

impl From<&UTCDateTime> for UnixTimestamp

Source§

fn from(value: &UTCDateTime) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for UnixTimestamp

Source§

fn from(value: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<JulianDayNumber<JulianEpoch>> for UnixTimestamp

Source§

fn from(value: JulianDate) -> Self

Converts to this type from the input type.
Source§

impl From<UTCDateTime> for UnixTimestamp

Source§

fn from(value: UTCDateTime) -> Self

Converts to this type from the input type.
Source§

impl<T> FromTimestamp<T> for UnixTimestamp

Source§

fn from_timestamp(other: &Timestamp<T>) -> Self

Source§

impl Serialize for UnixTimestamp

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more