Skip to content

Commit

Permalink
Do not use boxcar windowing when displaying the final total of the speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatekii authored and djc committed Feb 18, 2022
1 parent df95ad7 commit b5f8dfe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,15 @@ impl ProgressState {

/// The number of steps per second
pub(crate) fn per_sec(&self) -> f64 {
let per_sec = 1.0 / self.est.seconds_per_step();
if per_sec.is_nan() {
0.0
if matches!(&self.status, Status::InProgress) {
let per_sec = 1.0 / self.est.seconds_per_step();
if per_sec.is_nan() {
0.0
} else {
per_sec
}
} else {
per_sec
self.len as f64 / self.started.elapsed().as_secs_f64()
}
}

Expand Down

0 comments on commit b5f8dfe

Please sign in to comment.