maybe_backoff/
clock.rs

1#[cfg(not(target_family = "wasm"))]
2use std::time::Instant;
3#[cfg(target_family = "wasm")]
4use web_time::Instant;
5
6/// Clock returns the current time.
7pub trait Clock {
8    fn now(&self) -> Instant;
9}
10
11/// `SystemClock` uses the system's clock to get the current time.
12/// This Clock should be used for real use-cases.
13#[derive(Debug, Default, Clone)]
14pub struct SystemClock {}
15
16impl Clock for SystemClock {
17    fn now(&self) -> Instant {
18        Instant::now()
19    }
20}