aboutsummaryrefslogtreecommitdiff
path: root/src/filters.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/filters.rs')
-rw-r--r--src/filters.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/filters.rs b/src/filters.rs
index 1549c26..c6df6e8 100644
--- a/src/filters.rs
+++ b/src/filters.rs
@@ -31,3 +31,17 @@ pub fn filter_outcome(result: &LogResult, opt: &Opt) -> bool {
_ => false,
}
}
+
+/// Do filtering based on encounter time.
+pub fn filter_time(result: &LogResult, opt: &Opt) -> bool {
+ let after_ok = match opt.after {
+ Some(time) => time <= result.time,
+ None => true,
+ };
+ let before_ok = match opt.before {
+ Some(time) => time >= result.time,
+ None => true,
+ };
+
+ after_ok && before_ok
+}