Skip to main content

compute_duration

Function compute_duration 

Source
pub fn compute_duration(
    start: &str,
    end: &str,
) -> Result<DurationInfo, TruthError>
Expand description

Compute the duration between two timestamps.

§Arguments

  • start — An RFC 3339 datetime string
  • end — An RFC 3339 datetime string

§Returns

A DurationInfo with the total seconds and decomposed days/hours/minutes/seconds. If end is before start, total_seconds is negative and the decomposition represents the absolute duration.

§Errors

Returns TruthError::InvalidDatetime if either datetime string cannot be parsed.