console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.41k stars 241 forks source link

Fix AtomicPosition::reset storing wrong value #650

Closed TheJokr closed 3 months ago

TheJokr commented 3 months ago

AtomicPosition::allow interprets self.prev as a number of nanoseconds since self.start, but AtomicPosition::reset instead stored a number of milliseconds in there. This is a bug, albeit without significant consequences.

I reckon the bug got introduced because the comments are worded a bit ambiguously, so I cleared those up and added a regression test for the future.

TheJokr commented 3 months ago

I was checking out how often tick() is scheduled by ProgressBar::inc(), so I read through that part of the code and was confused by the comments 😅 And then I noticed the inconsistency with the reset() function, which was right below.