@@ -79,7 +79,7 @@ namespace __formatter {
79
79
// small). Therefore a duration uses its own conversion.
80
80
template <class _CharT , class _Rep , class _Period >
81
81
_LIBCPP_HIDE_FROM_ABI void
82
- __format_sub_seconds (const chrono::duration<_Rep, _Period>& __value, basic_stringstream<_CharT>& __sstr ) {
82
+ __format_sub_seconds (basic_stringstream<_CharT>& __sstr, const chrono::duration<_Rep, _Period>& __value) {
83
83
__sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc ()).decimal_point ();
84
84
85
85
using __duration = chrono::duration<_Rep, _Period>;
@@ -110,13 +110,13 @@ __format_sub_seconds(const chrono::duration<_Rep, _Period>& __value, basic_strin
110
110
}
111
111
112
112
template <class _CharT , __is_time_point _Tp>
113
- _LIBCPP_HIDE_FROM_ABI void __format_sub_seconds (const _Tp& __value, basic_stringstream<_CharT>& __sstr) {
114
- __formatter::__format_sub_seconds (__value.time_since_epoch (), __sstr );
113
+ _LIBCPP_HIDE_FROM_ABI void __format_sub_seconds (basic_stringstream<_CharT>& __sstr, const _Tp& __value ) {
114
+ __formatter::__format_sub_seconds (__sstr, __value.time_since_epoch ());
115
115
}
116
116
117
117
template <class _CharT , class _Duration >
118
118
_LIBCPP_HIDE_FROM_ABI void
119
- __format_sub_seconds (const chrono::hh_mm_ss<_Duration>& __value, basic_stringstream<_CharT>& __sstr ) {
119
+ __format_sub_seconds (basic_stringstream<_CharT>& __sstr, const chrono::hh_mm_ss<_Duration>& __value) {
120
120
__sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc ()).decimal_point ();
121
121
if constexpr (chrono::treat_as_floating_point_v<typename _Duration::rep>)
122
122
std::format_to (std::ostreambuf_iterator<_CharT>{__sstr},
@@ -143,7 +143,7 @@ consteval bool __use_fraction() {
143
143
}
144
144
145
145
template <class _CharT >
146
- _LIBCPP_HIDE_FROM_ABI void __format_year (int __year, basic_stringstream<_CharT>& __sstr) {
146
+ _LIBCPP_HIDE_FROM_ABI void __format_year (basic_stringstream<_CharT>& __sstr, int __year ) {
147
147
if (__year < 0 ) {
148
148
__sstr << _CharT (' -' );
149
149
__year = -__year;
@@ -159,7 +159,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_year(int __year, basic_stringstream<_CharT>&
159
159
}
160
160
161
161
template <class _CharT >
162
- _LIBCPP_HIDE_FROM_ABI void __format_century (int __year, basic_stringstream<_CharT>& __sstr) {
162
+ _LIBCPP_HIDE_FROM_ABI void __format_century (basic_stringstream<_CharT>& __sstr, int __year ) {
163
163
// TODO FMT Write an issue
164
164
// [tab:time.format.spec]
165
165
// %C The year divided by 100 using floored division. If the result is a
@@ -172,7 +172,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_century(int __year, basic_stringstream<_Char
172
172
173
173
template <class _CharT , class _Tp >
174
174
_LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs (
175
- const _Tp& __value, basic_stringstream<_CharT>& __sstr, basic_string_view<_CharT> __chrono_specs) {
175
+ basic_stringstream<_CharT>& __sstr, const _Tp& __value , basic_string_view<_CharT> __chrono_specs) {
176
176
tm __t = std::__convert_to_tm<tm>(__value);
177
177
const auto & __facet = std::use_facet<time_put<_CharT>>(__sstr.getloc ());
178
178
for (auto __it = __chrono_specs.begin (); __it != __chrono_specs.end (); ++__it) {
@@ -196,7 +196,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
196
196
// strftime's output is only defined in the range [00, 99].
197
197
int __year = __t .tm_year + 1900 ;
198
198
if (__year < 1000 || __year > 9999 )
199
- __formatter::__format_century (__year, __sstr );
199
+ __formatter::__format_century (__sstr, __year );
200
200
else
201
201
__facet.put (
202
202
{__sstr}, __sstr, _CharT (' ' ), std::addressof (__t ), std::to_address (__s), std::to_address (__it + 1 ));
@@ -242,7 +242,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
242
242
__facet.put (
243
243
{__sstr}, __sstr, _CharT (' ' ), std::addressof (__t ), std::to_address (__s), std::to_address (__it + 1 ));
244
244
if constexpr (__use_fraction<_Tp>())
245
- __formatter::__format_sub_seconds (__value, __sstr );
245
+ __formatter::__format_sub_seconds (__sstr, __value );
246
246
break ;
247
247
248
248
// Unlike time_put and strftime the formatting library requires %Y
@@ -283,13 +283,13 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
283
283
// Depending on the platform's libc the range of supported years is
284
284
// limited. Intead of of testing all conditions use the internal
285
285
// implementation unconditionally.
286
- __formatter::__format_year (__t .tm_year + 1900 , __sstr );
286
+ __formatter::__format_year (__sstr, __t .tm_year + 1900 );
287
287
break ;
288
288
289
289
case _CharT (' F' ): {
290
290
int __year = __t .tm_year + 1900 ;
291
291
if (__year < 1000 ) {
292
- __formatter::__format_year (__year, __sstr );
292
+ __formatter::__format_year (__sstr, __year );
293
293
__sstr << std::format (_LIBCPP_STATICALLY_WIDEN (_CharT, " -{:02}-{:02}" ), __t .tm_mon + 1 , __t .tm_mday );
294
294
} else
295
295
__facet.put (
@@ -310,7 +310,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
310
310
++__it;
311
311
__facet.put (
312
312
{__sstr}, __sstr, _CharT (' ' ), std::addressof (__t ), std::to_address (__s), std::to_address (__it + 1 ));
313
- __formatter::__format_sub_seconds (__value, __sstr );
313
+ __formatter::__format_sub_seconds (__sstr, __value );
314
314
break ;
315
315
}
316
316
}
@@ -512,7 +512,7 @@ __format_chrono(const _Tp& __value,
512
512
if constexpr (chrono::__is_duration<_Tp>::value) {
513
513
if (__value < __value.zero ())
514
514
__sstr << _CharT (' -' );
515
- __formatter::__format_chrono_using_chrono_specs (chrono::abs (__value), __sstr , __chrono_specs);
515
+ __formatter::__format_chrono_using_chrono_specs (__sstr, chrono::abs (__value), __chrono_specs);
516
516
// TODO FMT When keeping the precision it will truncate the string.
517
517
// Note that the behaviour what the precision does isn't specified.
518
518
__specs.__precision_ = -1 ;
@@ -556,7 +556,7 @@ __format_chrono(const _Tp& __value,
556
556
__sstr << _CharT (' -' );
557
557
}
558
558
559
- __formatter::__format_chrono_using_chrono_specs (__value, __sstr , __chrono_specs);
559
+ __formatter::__format_chrono_using_chrono_specs (__sstr, __value , __chrono_specs);
560
560
}
561
561
}
562
562
0 commit comments