aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/records.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/remake/records.rs')
-rw-r--r--src/remake/records.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/remake/records.rs b/src/remake/records.rs
index 22aaee3..9b0c8f1 100644
--- a/src/remake/records.rs
+++ b/src/remake/records.rs
@@ -75,6 +75,13 @@ impl Retention {
self.epochs.is_some_and(|limit| epochs <= limit)
|| self.age_ms.is_some_and(|limit| age_ms <= limit)
}
+
+ /// How long until its age limit passes, `age_ms` after the fact, where that is
+ /// ahead: none where it has none, or it passed, and the count of epochs decides.
+ pub(crate) fn age_left(&self, age_ms: u64) -> Option<std::time::Duration> {
+ let left = self.age_ms?.checked_sub(age_ms)?;
+ Some(std::time::Duration::from_millis(left))
+ }
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]