@@ -5465,28 +5465,33 @@ namespace chrono {
5465
5465
_STL_INTERNAL_CHECK(false);
5466
5466
}
5467
5467
5468
- template <class _CharT, class _Traits, class _Duration >
5469
- void _Write_seconds(basic_ostream<_CharT, _Traits>& _Os, const hh_mm_ss<_Duration>& _Val ) {
5470
- _Os << _STD format(_STATICALLY_WIDEN(_CharT, "{:02}"), _Val.seconds() .count());
5471
- if constexpr (hh_mm_ss<_Duration>::fractional_width > 0) {
5468
+ template <unsigned int _Fractional_width, class _CharT, class _Traits, class _Precision >
5469
+ void _Write_seconds(basic_ostream<_CharT, _Traits>& _Os, const seconds& _Seconds, const _Precision& _Subseconds ) {
5470
+ _Os << _STD format(_STATICALLY_WIDEN(_CharT, "{:02}"), _Seconds .count());
5471
+ if constexpr (_Fractional_width > 0) {
5472
5472
_Os << _STD use_facet<numpunct<_CharT>>(_Os.getloc()).decimal_point();
5473
- if constexpr (treat_as_floating_point_v<typename hh_mm_ss<_Duration>::precision::rep>) {
5474
- _Os << _STD format(_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"), _STD floor(_Val.subseconds().count()),
5475
- _Val.fractional_width);
5476
- } else {
5473
+ if constexpr (treat_as_floating_point_v<_Precision::rep>) {
5477
5474
_Os << _STD format(
5478
- _STATICALLY_WIDEN(_CharT, "{:0{}}"), _Val.subseconds().count(), _Val.fractional_width);
5475
+ _STATICALLY_WIDEN(_CharT, "{:0{}.0f}"), _STD floor(_Subseconds.count()), _Fractional_width);
5476
+ } else {
5477
+ _Os << _STD format(_STATICALLY_WIDEN(_CharT, "{:0{}}"), _Subseconds.count(), _Fractional_width);
5479
5478
}
5480
5479
}
5481
5480
}
5482
5481
5482
+ template <class _CharT, class _Traits, class _Duration>
5483
+ void _Write_seconds(basic_ostream<_CharT, _Traits>& _Os, const hh_mm_ss<_Duration>& _Val) {
5484
+ _Write_seconds<_Val.fractional_width>(_Os, _Val.seconds(), _Val.subseconds());
5485
+ }
5486
+
5483
5487
template <class _CharT, class _Traits, class _Clock, class _Duration>
5484
5488
void _Write_seconds(basic_ostream<_CharT, _Traits>& _Os, const time_point<_Clock, _Duration>& _Val) {
5485
5489
if constexpr (is_same_v<_Clock, utc_clock>) {
5490
+ const auto _Dp = _CHRONO floor<days>(_Val) + get_leap_second_info(_Val).elapsed;
5491
+ const auto _Hms = hh_mm_ss{_Val - _Dp};
5486
5492
if (_CHRONO get_leap_second_info(_Val).is_leap_second) {
5487
- _Os << _STATICALLY_WIDEN(_CharT, "60" );
5493
+ _Write_seconds<_Hms.fractional_width>( _Os, _Hms.seconds() + 60s, _Hms.subseconds() );
5488
5494
} else {
5489
- const auto _Dp = _CHRONO floor<days>(_Val) + get_leap_second_info(_Val).elapsed;
5490
5495
_Write_seconds(_Os, hh_mm_ss{_Val - _Dp});
5491
5496
}
5492
5497
return;
0 commit comments