[libcxx-commits] [libcxx] [libc++][chrono] Fix streaming for unsigned durations. (PR #97889)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 9 11:28:11 PDT 2024
================
@@ -589,9 +590,14 @@ __format_chrono(const _Tp& __value,
__sstr << __value;
else {
if constexpr (chrono::__is_duration<_Tp>::value) {
- if (__value < __value.zero())
- __sstr << _CharT('-');
- __formatter::__format_chrono_using_chrono_specs(__sstr, chrono::abs(__value), __chrono_specs);
+ if constexpr (numeric_limits<typename _Tp::rep>::is_signed) {
----------------
ldionne wrote:
I would use `std::is_signed_v<typename _Tp::rep>` instead. It allows you to include only `<__type_traits/is_signed.h>`.
https://github.com/llvm/llvm-project/pull/97889
More information about the libcxx-commits
mailing list