Type timespec

type timespec = {sec: i64, nsec: i32,}

A record specifying a time value in seconds and microseconds.

Type tm

type 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,}

Implementation tm for tm

Method to_timespec

fn to_timespec() -> timespec

Convert time to the seconds from January 1, 1970

Method to_local

fn to_local() -> tm

Convert time to the local timezone

Method to_utc

fn to_utc() -> tm

Convert time to the UTC

Method ctime

fn ctime() -> str

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

Method strftime

fn strftime(format: str) -> str

Formats the time according to the format string.

Method rfc822

fn rfc822() -> 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"

Method rfc822z

fn rfc822z() -> 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"

Method rfc3339

fn rfc3339() -> str

Returns a time string formatted according to ISO 8601.

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

Function at

fn at(clock: timespec) -> tm

Returns the specified time in the local timezone

Function at_utc

fn at_utc(clock: timespec) -> tm

Returns the specified time in UTC

Function empty_tm

fn empty_tm() -> tm

Function get_time

fn get_time() -> timespec

Returns the current time as a timespec containing the seconds and microseconds since 1970-01-01T00:00:00Z.

Function now

fn now() -> tm

Returns the current time in the local timezone

Function now_utc

fn now_utc() -> tm

Returns the current time in UTC

Function precise_time_ns

fn precise_time_ns() -> u64

Returns the current value of a high-resolution performance counter in nanoseconds since an unspecified epoch.

Function precise_time_s

fn precise_time_s() -> float

Returns the current value of a high-resolution performance counter in seconds since an unspecified epoch.

Function strptime

fn strptime(s: str, format: str) -> result<tm, str>

Parses the time from the string according to the format string.

Function tzset

fn tzset()