[−][src]Struct time::Tm
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]
Methods
impl Tm[src]
impl Tmpub fn to_timespec(&self) -> Timespec[src]
pub fn to_timespec(&self) -> TimespecConvert time to the seconds from January 1, 1970
pub fn to_local(&self) -> Tm[src]
pub fn to_local(&self) -> TmConvert time to the local timezone
pub fn to_utc(&self) -> Tm[src]
pub fn to_utc(&self) -> TmConvert time to the UTC
pub fn ctime(&self) -> TmFmt[src]
pub fn ctime(&self) -> TmFmtReturns a TmFmt that outputs according to the asctime format in ISO
C, in the local timezone.
Example: "Thu Jan 1 00:00:00 1970"
pub fn asctime(&self) -> TmFmt[src]
pub fn asctime(&self) -> TmFmtReturns a TmFmt that outputs according to the asctime format in ISO
C.
Example: "Thu Jan 1 00:00:00 1970"
pub fn strftime<'a>(&'a self, format: &'a str) -> Result<TmFmt<'a>, ParseError>[src]
pub fn strftime<'a>(&'a self, format: &'a str) -> Result<TmFmt<'a>, ParseError>Formats the time according to the format string.
pub fn rfc822(&self) -> TmFmt[src]
pub fn rfc822(&self) -> TmFmtReturns 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"
pub fn rfc822z(&self) -> TmFmt[src]
pub fn rfc822z(&self) -> TmFmtReturns a TmFmt that outputs according to RFC 822 with Zulu time.
local: "Thu, 22 Mar 2012 07:53:18 -0700" utc: "Thu, 22 Mar 2012 14:53:18 -0000"
pub fn rfc3339<'a>(&'a self) -> TmFmt[src]
pub fn rfc3339<'a>(&'a self) -> TmFmtReturns a TmFmt that outputs according to RFC 3339. RFC 3339 is compatible with ISO 8601.
local: "2012-02-22T07:53:18-07:00" utc: "2012-02-22T14:53:18Z"
Trait Implementations
impl Clone for Tm[src]
impl Clone for Tmfn clone(&self) -> Tm[src]
fn clone(&self) -> TmReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Copy for Tm[src]
impl Copy for Tmimpl Eq for Tm[src]
impl Eq for Tmimpl PartialOrd<Tm> for Tm[src]
impl PartialOrd<Tm> for Tmfn partial_cmp(&self, other: &Tm) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &Tm) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
#[must_use]
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn lt(&self, other: &Rhs) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl PartialEq<Tm> for Tm[src]
impl PartialEq<Tm> for Tmfn eq(&self, other: &Tm) -> bool[src]
fn eq(&self, other: &Tm) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Tm) -> bool[src]
fn ne(&self, other: &Tm) -> boolThis method tests for !=.
impl Ord for Tm[src]
impl Ord for Tmfn cmp(&self, other: &Tm) -> Ordering[src]
fn cmp(&self, other: &Tm) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl Hash for Tm[src]
impl Hash for Tmfn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl Debug for Tm[src]
impl Debug for Tmfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Add<Duration> for Tm[src]
impl Add<Duration> for Tmtype Output = Tm
The resulting type after applying the + operator.
fn add(self, other: Duration) -> Tm[src]
fn add(self, other: Duration) -> TmThe resulting Tm is in UTC.
impl Sub<Duration> for Tm[src]
impl Sub<Duration> for Tmtype Output = Tm
The resulting type after applying the - operator.
fn sub(self, other: Duration) -> Tm[src]
fn sub(self, other: Duration) -> TmThe resulting Tm is in UTC.
impl Sub<Tm> for Tm[src]
impl Sub<Tm> for TmAuto Trait Implementations
Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, type Owned = T
fn to_owned(&self) -> T[src]
fn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)[src]
fn clone_into(&self, target: &mut T)🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more