Struct aws_smithy_types::instant::Instant[][src]

pub struct Instant { /* fields omitted */ }
Expand description

Instant in time.

Instant in time represented as seconds and sub-second nanos since the Unix epoch (January 1, 1970 at midnight UTC/GMT).

Implementations

Creates an Instant from a number of seconds since the Unix epoch.

Creates an Instant from a number of seconds and a fractional second since the Unix epoch.

Example
assert_eq!(
    Instant::from_secs_and_nanos(1, 500_000_000u32),
    Instant::from_fractional_seconds(1, 0.5),
);

Creates an Instant from a number of seconds and sub-second nanos since the Unix epoch.

Example
assert_eq!(
    Instant::from_fractional_seconds(1, 0.5),
    Instant::from_secs_and_nanos(1, 500_000_000u32),
);

Creates an Instant from an f64 representing the number of seconds since the Unix epoch.

Example
assert_eq!(
    Instant::from_fractional_seconds(1, 0.5),
    Instant::from_f64(1.5),
);

Creates an Instant from a SystemTime.

Parses an Instant from a string using the given format.

Read 1 date of format from s, expecting either delim or EOF

Enable parsing multiple dates from the same string

Converts the Instant to a chrono DateTime<Utc>.

Convert this Instant to a SystemTime

Since SystemTime cannot represent times prior to the unix epoch, if this time is before 1/1/1970, this function will return None.

Returns true if sub-second nanos is greater than zero.

Returns the Instant value as an f64 representing the seconds since the Unix epoch.

Returns the epoch seconds component of the Instant.

Note: this does not include the sub-second nanos.

Returns the sub-second nanos component of the Instant.

Note: this does not include the number of seconds since the epoch.

Converts the Instant to the number of milliseconds since the Unix epoch. This is fallible since Instant holds more precision than an i64, and will return a ConversionError for Instant values that can’t be converted.

Converts number of milliseconds since the Unix epoch into an Instant.

Formats the Instant to a string using the given format.

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

Performs the conversion.

Performs the conversion.

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

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.