pub struct Time {
    pub seconds_since_unix_epoch: u32,
    pub offset_in_seconds: i32,
    pub sign: Sign,
}
Expand description

A timestamp with timezone.

Fields

seconds_since_unix_epoch: u32

time in seconds since epoch.

offset_in_seconds: i32

time offset in seconds, may be negative to match the sign field.

sign: Sign

the sign of offset, used to encode -0000 which would otherwise loose sign information.

Implementations

Formatting

Format this instance according to the given format.

Use the [format_description] macro to create and validate formats at compile time, courtesy of the time crate.

Instantiation

Create a new instance from seconds and offset.

Return the current time without figuring out a timezone offset

Return the current local time, or None if the local time wasn’t available.

Return the current local time, or the one at UTC if the local time wasn’t available.

Serialization with standard git format

Serialize this instance into memory, similar to what write_to() would do with arbitrary Write implementations.

Serialize this instance to out in a format suitable for use in header fields of serialized git commits or tags.

Computes the number of bytes necessary to render this time.

Access

Return true if this time has been initialized to anything non-default, i.e. 0.

Return the passed seconds since epoch since this signature was made.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.