This adds support for `%j` presentation type for duration types:
> "If the type being formatted is a specialization of duration, the decimal
number of days without padding."
Fixes#3643.
* Fix#3725 and rename fmt_safe_duration_cast to fmt_duration_cast
The function is now more generic and will handle all casts. It also
takes care of toggling safe vs unsafe casts using
FMT_SAFE_DURATION_CAST.
* Refactor fmt_duration_cast to put #ifdef inside the function
* Fix compilation error with FMT_USE_LOCAL_TIME
Fixes#2952. The testsuite indirectly called strftime() with conversion
specifiers defined only in C99. In MSVCRT this function conforms only to
C89. Only in the updated UCRT this functon provides the functionality of
C99.
* 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 <victor.zverovich@gmail.com>
* 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 <victor.zverovich@gmail.com>
This prevents accidentally writing fmt::format when fmt::print was
intended. Other than running tests, there's not a good use case for
discarding the formatted output.
* Fix unicode test
* Add xchar support to chrono formatter
* Replace strftime with std::time_put
* Add std::locale support to std::tm formatter
* Use predefined names and formats for C-locale
* Performance improvement
* Make locale-independent and C locale formats consistent among platforms