Struct devela::time::UnixTimeI64
source · pub struct UnixTimeI64 {
pub seconds: i64,
}Expand description
64-bit Unix time, supporting negative values.
Stores the number of seconds relative to the Unix Epoch (1970-01-01 00:00:00 UTC).
Fields§
§seconds: i64The number of seconds relative the Unix Epoch.
Implementations§
source§impl UnixTimeI64
impl UnixTimeI64
sourcepub fn new(seconds: i64) -> Self
pub fn new(seconds: i64) -> Self
Returns a new UnixTimeI64 from the given amount of seconds.
§Examples
assert_eq!["1970-01-01_00:00:01", UnixTimeI64::new(1).to_string()];
assert_eq!["1969-12-31_23:59:59", UnixTimeI64::new(-1).to_string()];
assert_eq!["2038-01-19_03:14:07", UnixTimeI64::new(i32::MAX as i64).to_string()];
assert_eq!["2106-02-07_06:28:15", UnixTimeI64::new(u32::MAX as i64).to_string()];
assert_eq!["1833-11-24_17:31:45", UnixTimeI64::new(u32::MAX as i64 * -1).to_string()];Trait Implementations§
source§impl Clone for UnixTimeI64
impl Clone for UnixTimeI64
source§fn clone(&self) -> UnixTimeI64
fn clone(&self) -> UnixTimeI64
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 UnixTimeI64
impl Debug for UnixTimeI64
source§impl Default for UnixTimeI64
impl Default for UnixTimeI64
source§fn default() -> UnixTimeI64
fn default() -> UnixTimeI64
Returns the “default value” for a type. Read more
source§impl Display for UnixTimeI64
impl Display for UnixTimeI64
source§impl From<UnixTimeU32> for UnixTimeI64
impl From<UnixTimeU32> for UnixTimeI64
source§fn from(ut: UnixTimeU32) -> UnixTimeI64
fn from(ut: UnixTimeU32) -> UnixTimeI64
Converts to this type from the input type.
source§impl From<i16> for UnixTimeI64
impl From<i16> for UnixTimeI64
source§fn from(seconds: i16) -> UnixTimeI64
fn from(seconds: i16) -> UnixTimeI64
Converts to this type from the input type.
source§impl From<i32> for UnixTimeI64
impl From<i32> for UnixTimeI64
source§fn from(seconds: i32) -> UnixTimeI64
fn from(seconds: i32) -> UnixTimeI64
Converts to this type from the input type.
source§impl From<i64> for UnixTimeI64
impl From<i64> for UnixTimeI64
source§fn from(seconds: i64) -> UnixTimeI64
fn from(seconds: i64) -> UnixTimeI64
Converts to this type from the input type.
source§impl From<i8> for UnixTimeI64
impl From<i8> for UnixTimeI64
source§fn from(seconds: i8) -> UnixTimeI64
fn from(seconds: i8) -> UnixTimeI64
Converts to this type from the input type.
source§impl From<u16> for UnixTimeI64
impl From<u16> for UnixTimeI64
source§fn from(seconds: u16) -> UnixTimeI64
fn from(seconds: u16) -> UnixTimeI64
Converts to this type from the input type.
source§impl From<u32> for UnixTimeI64
impl From<u32> for UnixTimeI64
source§fn from(seconds: u32) -> UnixTimeI64
fn from(seconds: u32) -> UnixTimeI64
Converts to this type from the input type.
source§impl From<u8> for UnixTimeI64
impl From<u8> for UnixTimeI64
source§fn from(seconds: u8) -> UnixTimeI64
fn from(seconds: u8) -> UnixTimeI64
Converts to this type from the input type.
source§impl Ord for UnixTimeI64
impl Ord for UnixTimeI64
source§fn cmp(&self, other: &UnixTimeI64) -> Ordering
fn cmp(&self, other: &UnixTimeI64) -> 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 UnixTimeI64
impl PartialEq for UnixTimeI64
source§fn eq(&self, other: &UnixTimeI64) -> bool
fn eq(&self, other: &UnixTimeI64) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd for UnixTimeI64
impl PartialOrd for UnixTimeI64
source§fn partial_cmp(&self, other: &UnixTimeI64) -> Option<Ordering>
fn partial_cmp(&self, other: &UnixTimeI64) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl TryFrom<SystemTime> for UnixTimeI64
impl TryFrom<SystemTime> for UnixTimeI64
§type Error = SystemTimeError
type Error = SystemTimeError
The type returned in the event of a conversion error.
source§impl TryFrom<UnixTimeI64> for UnixTimeU32
impl TryFrom<UnixTimeI64> for UnixTimeU32
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§fn try_from(ut: UnixTimeI64) -> Result<UnixTimeU32, Self::Error>
fn try_from(ut: UnixTimeI64) -> Result<UnixTimeU32, Self::Error>
Performs the conversion.
source§impl TryFrom<i128> for UnixTimeI64
impl TryFrom<i128> for UnixTimeI64
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<isize> for UnixTimeI64
impl TryFrom<isize> for UnixTimeI64
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<u128> for UnixTimeI64
impl TryFrom<u128> for UnixTimeI64
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<u64> for UnixTimeI64
impl TryFrom<u64> for UnixTimeI64
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<usize> for UnixTimeI64
impl TryFrom<usize> for UnixTimeI64
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
impl Copy for UnixTimeI64
impl Eq for UnixTimeI64
impl StructuralPartialEq for UnixTimeI64
Auto Trait Implementations§
impl Freeze for UnixTimeI64
impl RefUnwindSafe for UnixTimeI64
impl Send for UnixTimeI64
impl Sync for UnixTimeI64
impl Unpin for UnixTimeI64
impl UnwindSafe for UnixTimeI64
Blanket Implementations§
source§impl<T> Also for T
impl<T> Also for T
source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
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> ByteSize for T
impl<T> ByteSize for T
source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Returns the alignment of this type in bytes.
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> ExtAny for Twhere
T: Any,
impl<T> ExtAny for Twhere
T: Any,
source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
source§impl<T> Mem for Twhere
T: ?Sized,
impl<T> Mem for Twhere
T: ?Sized,
source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Whether dropping values of this type matters.
source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true if dropping values of this type matters.source§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
self without running its destructor.source§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Replaces
self with other, returning the previous value of self.source§fn mem_take(&mut self) -> Selfwhere
Self: Default,
fn mem_take(&mut self) -> Selfwhere
Self: Default,
Replaces
self with its default value, returning the previous value of self.source§fn mem_swap(&mut self, other: &mut Self)where
Self: Sized,
fn mem_swap(&mut self, other: &mut Self)where
Self: Sized,
Swaps the value of
self and other without deinitializing either one.source§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
Available on crate feature
unsafe_slice only.