diff --git a/crates/zoxide-engine/src/dir.rs b/crates/zoxide-engine/src/dir.rs index c613c30..5d24738 100644 --- a/crates/zoxide-engine/src/dir.rs +++ b/crates/zoxide-engine/src/dir.rs @@ -25,7 +25,7 @@ impl Dir { const DAY: Epoch = 24 * HOUR; const WEEK: Epoch = 7 * DAY; - let duration = now - self.last_accessed; + let duration = now.saturating_sub(self.last_accessed); if duration < HOUR { self.rank * 4.0 } else if duration < DAY { @@ -39,4 +39,4 @@ impl Dir { } pub type Rank = f64; -pub type Epoch = i64; // use a signed integer so subtraction can be performed on it +pub type Epoch = u64; diff --git a/src/util.rs b/src/util.rs index 73a0024..6bb2066 100644 --- a/src/util.rs +++ b/src/util.rs @@ -21,7 +21,7 @@ pub fn current_time() -> Result { .context("system clock set to invalid time")? .as_secs(); - Ok(current_time as _) + Ok(current_time) } pub fn path_to_str>(path: &P) -> Result<&str> {