Close unpaired spans on CTRL+D in live mode

This commit is contained in:
Campbell Alden 2023-07-26 15:01:12 +09:00
parent 1f532ead7f
commit 7d90764cbd
3 changed files with 8 additions and 3 deletions

View file

@ -71,7 +71,12 @@ fn live_spans() -> Vec<Duration> {
}
}
if let Some(unpaired) = seen {
println!("Ended with an open span from {unpaired}... Ignoring");
println!("Closing unpaired span now");
let mut now = Local::now().naive_local().time();
if now < unpaired {
now = now + Duration::hours(12);
}
durations.push(now - unpaired);
}
return durations;
}