diff --git a/gix-date/src/time/mod.rs b/gix-date/src/time/mod.rs index b403decdf88..abc2bfc3b60 100644 --- a/gix-date/src/time/mod.rs +++ b/gix-date/src/time/mod.rs @@ -65,6 +65,7 @@ mod sign { } mod impls { + use std::ops::Sub; use crate::{time::Sign, Time}; impl Default for Time { @@ -76,4 +77,18 @@ mod impls { } } } + + impl Sub for Time { + type Output = i64; + + fn sub(self, rhs: Self) -> Self::Output { + self.local_time() - rhs.local_time() + } + } + + impl Time { + fn local_time(&self) -> i64 { + self.seconds + self.offset as i64 + } + } }