Struct hourglass::Timespec [] [src]

pub struct Timespec { /* fields omitted */ }

An offset from the Unix Epoch.

Timespec is the building block of Datetime and can be converted from and to a Datetime. It is intrinsically expressed in the UTC timezone since it holds the number of seconds elapsed since the Unix Epoch 1970-01-01T00:00:00Z and therefore is not ambiguous.

It is equivalent to a Datetime without Timezone information and therefore does not have access to as much methods as its counterpart. For example, its date representation cannot be computed. In return, the type is simpler and easier to handle and move around. Like Datetime, Timespec is leap second aware.

Methods

impl Timespec
[src]

Return the Timespec representing now.

Create a new Timespec from a Unix timestamp. An InputError is returned if nano ∉ [0, 999999999].

Get the number of Unix seconds since the Unix Epoch.

Get the number of nanoseconds elapsed for the current second.

Convert the Timespec into a Datetime, given a Timezone. Note the Timespec is always expressed as a Unix time, so converting to a Datetime won't interpret the Timespec as anything other than an offset from Unix Epoch in UTC timezone.

Trait Implementations

impl Clone for Timespec
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Timespec
[src]

impl Debug for Timespec
[src]

Formats the value using the given formatter.

impl PartialEq<Timespec> for Timespec
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Timespec
[src]

impl PartialOrd<Timespec> for Timespec
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Timespec
[src]

This method returns an Ordering between self and other. Read more

impl Add<Deltatime> for Timespec
[src]

The resulting type after applying the + operator

The method for the + operator

impl Sub<Deltatime> for Timespec
[src]

The resulting type after applying the - operator

The method for the - operator

impl Sub<Timespec> for Timespec
[src]

The resulting type after applying the - operator

The method for the - operator