-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix panic when formatting
TimeStamp::MIN
(#838)
In order to print the minus sign of times, we detect the need for the minus sign, print it and then print the absolute value of the time. However, integers have a minimum value of which the absolute value is larger than the maximum value of the integer. So for example `i8` has a minimum value of `-128` and a maximum value of `127`. The absolute value therefore can't be represented. This caused a panic when formatting `TimeStamp::MIN` when overflow checks are enabled, such as when compiling with the debug profile. There was also a big lack of tests for the formatting of times. Tests are now included for all the important cases.
- Loading branch information
Showing
6 changed files
with
760 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.