[src]

Struct time::Tm

pub struct Tm {
    tm_sec: i32,
    tm_min: i32,
    tm_hour: i32,
    tm_mday: i32,
    tm_mon: i32,
    tm_year: i32,
    tm_wday: i32,
    tm_yday: i32,
    tm_isdst: i32,
    tm_gmtoff: i32,
    tm_zone: ~str,
    tm_nsec: i32,
}

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

Seconds after the minute – [0, 60]

tm_min

Minutes after the hour – [0, 59]

tm_hour

Hours after midnight – [0, 23]

tm_mday

Day of the month – [1, 31]

tm_mon

Months since January – [0, 11]

tm_year

Years since 1900

tm_wday

Days since Sunday – [0, 6]. 0 = Sunday, 1 = Monday, …, 6 = Saturday.

tm_yday

Days since January 1 – [0, 365]

tm_isdst

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_gmtoff

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_zone

Abbreviated name for the time zone that was used to compute this broken-down time value. For example, U.S. Pacific Daylight Time is "PDT".

tm_nsec

Nanoseconds after the second – [0, 109 - 1]

Methods

impl Tm

fn to_timespec(&self) -> Timespec

Convert time to the seconds from January 1, 1970

fn to_local(&self) -> Tm

Convert time to the local timezone

fn to_utc(&self) -> Tm

Convert time to the UTC

fn ctime(&self) -> ~str

Return a string of the current time in the form "Thu Jan 1 00:00:00 1970".

fn strftime(&self, format: &str) -> ~str

Formats the time according to the format string.

fn rfc822(&self) -> ~str

Returns a time string formatted according to RFC 822.

local: "Thu, 22 Mar 2012 07:53:18 PST" utc: "Thu, 22 Mar 2012 14:53:18 UTC"

fn rfc822z(&self) -> ~str

Returns a time string formatted 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"

fn rfc3339(&self) -> ~str

Returns a time string formatted according to ISO 8601.

local: "2012-02-22T07:53:18-07:00" utc: "2012-02-22T14:53:18Z"

Trait Implementations

Derived Implementations

impl Show for Tm

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl<__D: Decoder<__E>, __E> Decodable<__D, __E> for Tm

fn decode(__arg_0: &mut __D) -> Result<Tm, __E>

impl<__S: Encoder<__E>, __E> Encodable<__S, __E> for Tm

fn encode(&self, __arg_0: &mut __S) -> Result<(), __E>

impl Eq for Tm

fn eq(&self, __arg_0: &Tm) -> bool

fn ne(&self, __arg_0: &Tm) -> bool

impl Clone for Tm

fn clone(&self) -> Tm