-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement c++20 std::chrono::duration subsecond formatting (#2623)
* Add support for subsecond printing for std::chrono::duration according to the c++20 standard * Remove assert test that overflows intmax_t * * Hopefully fix int64_t to int32_t conversion errors. * Allow proper Duration::rep type to propagate via template argument deduction * * Hopefully fix int64_t to int32_t conversion errors. * Allow proper Duration::rep type to propagate via template argument deduction * Fix sign conversion (-Wsign-conversion) warning treated as error in num_digits() * Format chrono.h with clang-format * Remove extra forward slash in doxygen style comment Co-authored-by: Victor Zverovich <[email protected]> * Apply all suggestions from GitHub, except for replacing the utility subsecond_helper class with a function * * Move logic of handling subseconds from utility class to function with name write_fractional_seconds() * Revert write(Rep value, int width) function to previous state * Fix -Wshadow warning * Remove unsued get_subseconds() function, its logic has been moved to write_fractional_seconds() * Change comment from lowercase int to uppercase Int * Simplify test check * Integrate suggested changes * Remove static from detail functions, they are no longer member functions of a class and static is unnecessary. * Change comment from "amount" to "number" Co-authored-by: Victor Zverovich <[email protected]>
- Loading branch information
Showing
2 changed files
with
111 additions
and
34 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