From 640c9a9d6d59b32902e0f91b184f103c1ff7d12c Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 9 Jun 2025 13:23:11 +0300 Subject: [PATCH] parse time once per queue --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index c117f8b..346f414 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,13 +32,18 @@ fn main() -> anyhow::Result<()> { debug::info("Index queue begin..."); } + let now = argument + .match_time + .as_ref() + .map(|t| chrono::Local::now().format(t).to_string()); + let mut index: HashMap = HashMap::with_capacity(argument.capacity); 'l: for line in BufReader::new(File::open(&argument.source)?).lines() { let l = line?; - if let Some(ref t) = argument.match_time { - if !l.contains(&chrono::Local::now().format(t).to_string()) { + if let Some(ref t) = now { + if !l.contains(t) { if is_debug_d { debug::info(&format!("Record time mismatch time filter {t}")) }