parse time once per queue

This commit is contained in:
yggverse 2025-06-09 13:23:11 +03:00
parent 120f8811c2
commit 640c9a9d6d

View file

@ -32,13 +32,18 @@ fn main() -> anyhow::Result<()> {
debug::info("Index queue begin..."); 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<String, usize> = HashMap::with_capacity(argument.capacity); let mut index: HashMap<String, usize> = HashMap::with_capacity(argument.capacity);
'l: for line in BufReader::new(File::open(&argument.source)?).lines() { 'l: for line in BufReader::new(File::open(&argument.source)?).lines() {
let l = line?; let l = line?;
if let Some(ref t) = argument.match_time { if let Some(ref t) = now {
if !l.contains(&chrono::Local::now().format(t).to_string()) { if !l.contains(t) {
if is_debug_d { if is_debug_d {
debug::info(&format!("Record time mismatch time filter {t}")) debug::info(&format!("Record time mismatch time filter {t}"))
} }