pub struct Time { /* private fields */ }Expand description
A Time represents an instant in time with nanosecond precision.
Implementations§
Source§impl Time
impl Time
Sourcepub fn from_systime(sys_time: &SystemTime) -> Self
pub fn from_systime(sys_time: &SystemTime) -> Self
from_systime creates Time structure from std::time::SystemTime
Sourcepub fn from_unix(sec: i64, nsec: i64) -> Self
pub fn from_unix(sec: i64, nsec: i64) -> Self
unix returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC. It is valid to pass nsec outside the range [0, 999999999]. Not all sec values have a corresponding time value. One such value is 1<<63-1 (the largest i64 value).
This is the same as unix.
Source§impl Time
impl Time
Source§impl Time
impl Time
Sourcepub fn clock(&self) -> HMS
pub fn clock(&self) -> HMS
clock returns the hour, minute, and second within the day specified by self.
Sourcepub fn hour(&self) -> u8
pub fn hour(&self) -> u8
hour returns the hour within the day specified by t, in the range [0, 23].
Sourcepub fn minute(&self) -> u8
pub fn minute(&self) -> u8
minute returns the minute offset within the hour specified by t, in the range [0, 59].
Sourcepub fn second(&self) -> u8
pub fn second(&self) -> u8
second returns the second offset within the minute specified by t, in the range [0, 59].
Sourcepub fn nanosecond(&self) -> usize
pub fn nanosecond(&self) -> usize
nanosecond returns the nanosecond offset within the second specified by t, in the range [0, 999999999].
Source§impl Time
impl Time
pub fn unix(&self) -> i64
Sourcepub fn unix_nano(&self) -> i64
pub fn unix_nano(&self) -> i64
unix_nano returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC. The result is undefined if the Unix time in nanoseconds cannot be represented by an i64 (a date before the year 1678 or after 2262). Note that this means the result of calling unix_nano on the zero Time is undefined. The result does not depend on the location associated with t.