[−][src]Trait float_duration::duration::TimePoint
A specific point in time.
Types implementing TimePoint
can have a FloatDuration
computed between them
via float_duration_since
in either direction.
#Examples
// Don't forget to use TimePoint. use float_duration::{TimePoint, FloatDuration}; use std::time::Instant; let start = Instant::now(); perform_expensive_task(); // Computing a duration using `Instant` cannot fail, so it is safe to unwrap. let elapsed = Instant::now().float_duration_since(start).unwrap(); println!("Took {}.", elapsed);
Associated Types
type Error
The type returned if there is an error computing the duration.
Required Methods
fn float_duration_since(self, rhs: Rhs) -> Result<FloatDuration, Self::Error>
The amount of time between two TimePoint
s.
Implementations on Foreign Types
impl<Tz: TimeZone> TimePoint<DateTime<Tz>> for DateTime<Tz>
[src]
impl<Tz: TimeZone> TimePoint<DateTime<Tz>> for DateTime<Tz>
type Error = ()
fn float_duration_since(self, since: DateTime<Tz>) -> Result<FloatDuration, ()>
[src]
fn float_duration_since(self, since: DateTime<Tz>) -> Result<FloatDuration, ()>
impl<Tz: TimeZone> TimePoint<Date<Tz>> for Date<Tz>
[src]
impl<Tz: TimeZone> TimePoint<Date<Tz>> for Date<Tz>
type Error = ()
fn float_duration_since(self, since: Date<Tz>) -> Result<FloatDuration, ()>
[src]
fn float_duration_since(self, since: Date<Tz>) -> Result<FloatDuration, ()>
impl TimePoint<NaiveDate> for NaiveDate
[src]
impl TimePoint<NaiveDate> for NaiveDate
type Error = ()
fn float_duration_since(self, since: NaiveDate) -> Result<FloatDuration, ()>
[src]
fn float_duration_since(self, since: NaiveDate) -> Result<FloatDuration, ()>
impl TimePoint<NaiveTime> for NaiveTime
[src]
impl TimePoint<NaiveTime> for NaiveTime
type Error = ()
fn float_duration_since(self, since: NaiveTime) -> Result<FloatDuration, ()>
[src]
fn float_duration_since(self, since: NaiveTime) -> Result<FloatDuration, ()>
impl TimePoint<NaiveDateTime> for NaiveDateTime
[src]
impl TimePoint<NaiveDateTime> for NaiveDateTime
type Error = ()
fn float_duration_since(self, since: NaiveDateTime) -> Result<FloatDuration, ()>
[src]
fn float_duration_since(self, since: NaiveDateTime) -> Result<FloatDuration, ()>
impl TimePoint<Instant> for Instant
[src]
impl TimePoint<Instant> for Instant
type Error = ()
fn float_duration_since(self, since: Instant) -> Result<FloatDuration, ()>
[src]
fn float_duration_since(self, since: Instant) -> Result<FloatDuration, ()>
impl TimePoint<SystemTime> for SystemTime
[src]
impl TimePoint<SystemTime> for SystemTime
type Error = SystemTimeError
fn float_duration_since(
self,
since: SystemTime
) -> Result<FloatDuration, SystemTimeError>
[src]
fn float_duration_since(
self,
since: SystemTime
) -> Result<FloatDuration, SystemTimeError>