#[repr(C)]pub struct Tm {
pub tm_sec: i32,
pub tm_min: i32,
pub tm_hour: i32,
pub tm_mday: i32,
pub tm_mon: i32,
pub tm_year: i32,
pub tm_wday: i32,
pub tm_yday: i32,
pub tm_isdst: i32,
pub tm_utcoff: i32,
pub tm_nsec: i32,
}
Expand description
Holds a calendar date and time broken down into its components (year, month, day, and so on), also called a broken-down time value.
Fields
tm_sec: i32
Seconds after the minute - [0, 60]
tm_min: i32
Minutes after the hour - [0, 59]
tm_hour: i32
Hours after midnight - [0, 23]
tm_mday: i32
Day of the month - [1, 31]
tm_mon: i32
Months since January - [0, 11]
tm_year: i32
Years since 1900
tm_wday: i32
Days since Sunday - [0, 6]. 0 = Sunday, 1 = Monday, …, 6 = Saturday.
tm_yday: i32
Days since January 1 - [0, 365]
tm_isdst: i32
Daylight Saving Time flag.
This value is positive if Daylight Saving Time is in effect, zero if Daylight Saving Time is not in effect, and negative if this information is not available.
tm_utcoff: i32
Identifies the time zone that was used to compute this broken-down time
value, including any adjustment for Daylight Saving Time. This is the
number of seconds east of UTC. For example, for U.S. Pacific Daylight
Time, the value is -7*60*60 = -25200
.
tm_nsec: i32
Nanoseconds after the second - [0, 109 - 1]
Implementations
sourceimpl Tm
impl Tm
sourcepub fn to_timespec(&self) -> Timespec
pub fn to_timespec(&self) -> Timespec
Convert time to the seconds from January 1, 1970
sourcepub fn ctime(&self) -> TmFmt<'_>
pub fn ctime(&self) -> TmFmt<'_>
Returns a TmFmt that outputs according to the asctime
format in ISO
C, in the local timezone.
Example: “Thu Jan 1 00:00:00 1970”
sourcepub fn asctime(&self) -> TmFmt<'_>
pub fn asctime(&self) -> TmFmt<'_>
Returns a TmFmt that outputs according to the asctime
format in ISO
C.
Example: “Thu Jan 1 00:00:00 1970”
sourcepub fn strftime<'a>(&'a self, format: &'a str) -> Result<TmFmt<'a>, ParseError>
pub fn strftime<'a>(&'a self, format: &'a str) -> Result<TmFmt<'a>, ParseError>
Formats the time according to the format string.
sourcepub fn rfc822(&self) -> TmFmt<'_>
pub fn rfc822(&self) -> TmFmt<'_>
Returns a TmFmt that outputs according to RFC 822.
local: “Thu, 22 Mar 2012 07:53:18 PST” utc: “Thu, 22 Mar 2012 14:53:18 GMT”
Trait Implementations
sourceimpl Ord for Tm
impl Ord for Tm
sourceimpl PartialOrd<Tm> for Tm
impl PartialOrd<Tm> for Tm
sourcefn partial_cmp(&self, other: &Tm) -> Option<Ordering>
fn partial_cmp(&self, other: &Tm) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl Copy for Tm
impl Eq for Tm
impl StructuralEq for Tm
impl StructuralPartialEq for Tm
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more