Close unpaired spans on CTRL+D in live mode
This commit is contained in:
parent
1f532ead7f
commit
7d90764cbd
3 changed files with 8 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -354,7 +354,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time-track"
|
name = "time-track"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "time-track"
|
name = "time-track"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,12 @@ fn live_spans() -> Vec<Duration> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(unpaired) = seen {
|
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;
|
return durations;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue