Function xpct::approx_eq_time
source · pub fn approx_eq_time<'a>(
expected: SystemTime,
threshold: Duration
) -> Matcher<'a, SystemTime, SystemTime>
Expand description
Succeeds when the actual time approximately equals the expected time.
This accepts a threshold
duration and succeeds when the expected time is within that threshold
duration of the actual time.
Examples
use std::time::{SystemTime, Duration};
use xpct::{expect, approx_eq_time};
let actual = SystemTime::now();
let expected = SystemTime::now();
expect!(actual).to(approx_eq_time(expected, Duration::from_millis(1)));