Skip to content

Commit 6d31845

Browse files
afontenotdjc
authored andcommitted
resetting the elapsed time also resets ETA
1 parent 3d5dbb3 commit 6d31845

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/progress_bar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl ProgressBar {
307307
self.state().reset(Instant::now(), Reset::Eta);
308308
}
309309

310-
/// Resets elapsed time
310+
/// Resets elapsed time and the ETA calculation
311311
pub fn reset_elapsed(&self) {
312312
self.state().reset(Instant::now(), Reset::Elapsed);
313313
}

src/state.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ impl BarState {
6969
}
7070

7171
pub(crate) fn reset(&mut self, now: Instant, mode: Reset) {
72-
if let Reset::Eta | Reset::All = mode {
73-
self.state.est.reset(now);
74-
}
72+
// Always reset the estimator; this is the only reset that will occur if mode is
73+
// `Reset::Eta`.
74+
self.state.est.reset(now);
7575

7676
if let Reset::Elapsed | Reset::All = mode {
7777
self.state.started = now;

0 commit comments

Comments
 (0)