libsw_core/instant_impls/
std_instant.rs

1// libsw: stopwatch library
2// copyright (C) 2022-2023 Ula Shipman <ula.hello@mailbox.org>
3// licensed under MIT OR Apache-2.0
4
5extern crate std;
6
7use ::core::time::Duration;
8
9use crate::Instant;
10
11impl Instant for ::std::time::Instant {
12    fn now() -> Self {
13        Self::now()
14    }
15
16    fn checked_add(&self, duration: Duration) -> Option<Self> {
17        self.checked_add(duration)
18    }
19
20    fn checked_sub(&self, duration: Duration) -> Option<Self> {
21        self.checked_sub(duration)
22    }
23
24    fn saturating_duration_since(&self, earlier: Self) -> Duration {
25        self.saturating_duration_since(earlier)
26    }
27}