Skip to content

Commit

Permalink
Adds a -= to the CuDuration. (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbin authored Dec 22, 2024
1 parent e0e4562 commit 483f336
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/cu29_clock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use quanta::{Clock, Mock};
use serde::{Deserialize, Serialize};
use std::convert::Into;
use std::fmt::{Display, Formatter};
use std::ops::{AddAssign, Div, Mul};
use std::ops::{AddAssign, Div, Mul, SubAssign};
use std::sync::Arc;
use std::time::Duration;

Expand Down Expand Up @@ -92,6 +92,12 @@ impl AddAssign for CuDuration {
}
}

impl SubAssign for CuDuration {
fn sub_assign(&mut self, rhs: Self) {
self.0 -= rhs.0
}
}

// a way to divide a duration by a scalar.
// useful to compute averages for example.
impl<T> Div<T> for CuDuration
Expand Down

0 comments on commit 483f336

Please sign in to comment.