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
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 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
.
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Instant
impl UnwindSafe for Instant
Blanket Implementations
Mutably borrows from an owned value. Read more