Skip to content

Commit 627f0b9

Browse files
committed
unsafe timestamp sub implementation
1 parent f82dd52 commit 627f0b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/timestamp/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl std::ops::Sub<Duration> for Timestamp {
7979

8080
fn sub(self, rhs: Duration) -> Self::Output {
8181
match self {
82-
Timestamp::Instant(i) => Timestamp::Instant(i - rhs),
82+
Timestamp::Instant(i) => Timestamp::Instant(i.checked_sub(rhs).unwrap()),
8383
Timestamp::SystemTime(t) => Timestamp::SystemTime(t - rhs),
8484
#[cfg(windows)]
8585
Timestamp::PerformanceCounter(c) => Timestamp::PerformanceCounter(c - rhs),

0 commit comments

Comments
 (0)