pub struct Time { /* private fields */ }
Expand description
A timestamp, represented as seconds since the unix epoch.
Implementations§
Source§impl Time
impl Time
Sourcepub const fn new(secs: i64, nanos: NanoSeconds) -> Self
pub const fn new(secs: i64, nanos: NanoSeconds) -> Self
The time since the unix epoch
Sourcepub const fn from_secs(secs: i64) -> Self
pub const fn from_secs(secs: i64) -> Self
Create a time from the specified number of whole seconds.
Sourcepub fn secs(&self) -> i64
pub fn secs(&self) -> i64
Returns the number of whole seconds since the epoch
The returned value does not include the fractional (nanosecond) part of the duration,
which can be obtained using subsec_nanos
.
Sourcepub fn subsec_nanos(&self) -> u32
pub fn subsec_nanos(&self) -> u32
Returns the fractional part of this Time
, in nanoseconds.
This method does not return the length of the time when represented by nanoseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one billion).
Trait Implementations§
Source§impl BorshDeserialize for Time
impl BorshDeserialize for Time
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Time
impl BorshSerialize for Time
Source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
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 Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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