pub struct NetworkTime {
pub year: i32,
pub month: u8,
pub day: u8,
pub hour: u8,
pub minute: u8,
pub second: u8,
pub nanosecond: u32,
}Expand description
Fully specified calendar and time-of-day in UTC-like Unix time representation.
Fields§
§year: i32Calendar year.
month: u8Calendar month in the range 1..=12.
day: u8Day of month in the range 1..=31.
hour: u8Hour of day in the range 0..=23.
minute: u8Minute in the range 0..=59.
second: u8Second in the range 0..=59.
nanosecond: u32Nanosecond within the current second.
Implementations§
Source§impl NetworkTime
impl NetworkTime
Sourcepub fn from_unix_ns(unix_ns: i128) -> Option<Self>
pub fn from_unix_ns(unix_ns: i128) -> Option<Self>
Converts a non-negative Unix nanosecond timestamp into calendar/time fields.
Sourcepub fn as_unix_ns(&self) -> Option<i128>
pub fn as_unix_ns(&self) -> Option<i128>
Converts this calendar/time value into Unix nanoseconds if the fields are valid.
Sourcepub fn as_unix_ms(&self) -> Option<u64>
pub fn as_unix_ms(&self) -> Option<u64>
Converts this calendar/time value into non-negative Unix milliseconds.
Trait Implementations§
Source§impl Clone for NetworkTime
impl Clone for NetworkTime
Source§fn clone(&self) -> NetworkTime
fn clone(&self) -> NetworkTime
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for NetworkTime
Source§impl Debug for NetworkTime
impl Debug for NetworkTime
impl Eq for NetworkTime
Source§impl From<NetworkTime> for PartialNetworkTime
impl From<NetworkTime> for PartialNetworkTime
Source§fn from(value: NetworkTime) -> Self
fn from(value: NetworkTime) -> Self
Converts to this type from the input type.
Source§impl PartialEq for NetworkTime
impl PartialEq for NetworkTime
Source§fn eq(&self, other: &NetworkTime) -> bool
fn eq(&self, other: &NetworkTime) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for NetworkTime
Auto Trait Implementations§
impl Freeze for NetworkTime
impl RefUnwindSafe for NetworkTime
impl Send for NetworkTime
impl Sync for NetworkTime
impl Unpin for NetworkTime
impl UnsafeUnpin for NetworkTime
impl UnwindSafe for NetworkTime
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