Fix AtomicPosition::reset storing wrong value#650
Merged
djc merged 2 commits intoconsole-rs:mainfrom Jul 12, 2024
TheJokr:fix-position-reset
Merged
Fix AtomicPosition::reset storing wrong value#650djc merged 2 commits intoconsole-rs:mainfrom TheJokr:fix-position-reset
djc merged 2 commits intoconsole-rs:mainfrom
TheJokr:fix-position-reset
Conversation
Resetting AtomicPosition incorrectly stores the elapsed time in ms inside `prev`, but AtomicPosition::allow expects this value to be in ns.
The code actually expects this value to be in ns. I reckon the bug got introduced because the comments are worded a bit ambiguously, so I also cleared those up.
djc
approved these changes
Jul 11, 2024
Member
djc
left a comment
There was a problem hiding this comment.
Awesome, thanks! How did you find this?
Contributor
Author
|
I was checking out how often |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AtomicPosition::allowinterpretsself.prevas a number of nanoseconds sinceself.start, butAtomicPosition::resetinstead 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.