Struct glib::date::TimeVal
[−]
[src]
pub struct TimeVal { pub tv_sec: c_long, pub tv_usec: c_long, }
Represents a precise time, with seconds and microseconds. Similar to the struct timeval returned by the gettimeofday() UNIX system call.
GLib is attempting to unify around the use of 64bit integers to represent microsecond-precision time. As such, this type will be removed from a future version of GLib.
Fields
tv_sec | seconds |
tv_usec | microseconds |
Methods
impl TimeVal
fn add(&mut self, microseconds: u64)
Adds the given number of microseconds to self . microseconds can also be negative to decrease the value of self .
fn from_iso8601(&mut self, iso_date: &str)
Converts a string containing an ISO 8601 encoded date and time to a GTimeVal and puts it into self .
iso_date must include year, month, day, hours, minutes, and seconds. It can optionally include fractions of a second and a time zone indicator. (In the absence of any time zone indication, the timestamp is assumed to be in local time.)
fn to_iso8601(&mut self) -> Option<String>
Converts time_ into an RFC 3339 encoded string, relative to the Coordinated Universal Time (UTC). This is one of the many formats allowed by ISO 8601.
ISO 8601 allows a large number of date/time formats, with or without punctuation and optional elements. The format returned by this function is a complete date and time, with optional punctuation included, the UTC time zone represented as "Z", and the tv_usec part included if and only if it is nonzero, i.e. either "YYYY-MM-DDTHH:MM:SSZ" or "YYYY-MM-DDTHH:MM:SS.fffffZ".
This corresponds to the Internet date/time format defined by RFC 3339, and to either of the two most-precise formats defined by the W3C Note Date and Time Formats. Both of these documents are profiles of ISO 8601.
Use g_date_time_format() or g_strdup_printf() if a different variation of ISO 8601 format is required.