30#ifndef _GLIBCXX_CHRONO_IO_H
31#define _GLIBCXX_CHRONO_IO_H 1
33#pragma GCC system_header
35#if __cplusplus >= 202002L
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
60 template<
typename _CharT>
62 _Widen(
const char* __narrow,
const wchar_t* __wide)
64 if constexpr (is_same_v<_CharT, wchar_t>)
69#define _GLIBCXX_WIDEN_(C, S) ::std::chrono::__detail::_Widen<C>(S, L##S)
70#define _GLIBCXX_WIDEN(S) _GLIBCXX_WIDEN_(_CharT, S)
74 template<
typename _Period>
76 __units_suffix_misc(
char* __buf,
size_t )
noexcept
81 unsigned __nlen = __tc::__to_chars_len((uintmax_t)_Period::num);
82 __tc::__to_chars_10_impl(__p + 1, __nlen, (uintmax_t)_Period::num);
84 if constexpr (_Period::den != 1)
87 unsigned __dlen = __tc::__to_chars_len((uintmax_t)_Period::den);
88 __tc::__to_chars_10_impl(__p + 1, __dlen, (uintmax_t)_Period::den);
97 template<
typename _Period,
typename _CharT>
99 __units_suffix(
char* __buf,
size_t __n)
noexcept
104#define _GLIBCXX_UNITS_SUFFIX(period, suffix) \
105 if constexpr (is_same_v<_Period, period>) \
106 return _GLIBCXX_WIDEN(suffix); \
109 _GLIBCXX_UNITS_SUFFIX(
atto,
"as")
110 _GLIBCXX_UNITS_SUFFIX(
femto,
"fs")
111 _GLIBCXX_UNITS_SUFFIX(
pico,
"ps")
112 _GLIBCXX_UNITS_SUFFIX(
nano,
"ns")
113 _GLIBCXX_UNITS_SUFFIX(
milli,
"ms")
114#if _GLIBCXX_USE_ALT_MICROSECONDS_SUFFIX
117 _GLIBCXX_UNITS_SUFFIX(
micro,
"\u00b5s")
119 _GLIBCXX_UNITS_SUFFIX(
micro,
"us")
121 _GLIBCXX_UNITS_SUFFIX(
centi,
"cs")
122 _GLIBCXX_UNITS_SUFFIX(
deci,
"ds")
123 _GLIBCXX_UNITS_SUFFIX(
ratio<1>,
"s")
124 _GLIBCXX_UNITS_SUFFIX(
deca,
"das")
125 _GLIBCXX_UNITS_SUFFIX(
hecto,
"hs")
126 _GLIBCXX_UNITS_SUFFIX(
kilo,
"ks")
127 _GLIBCXX_UNITS_SUFFIX(
mega,
"Ms")
128 _GLIBCXX_UNITS_SUFFIX(
giga,
"Gs")
129 _GLIBCXX_UNITS_SUFFIX(
tera,
"Ts")
130 _GLIBCXX_UNITS_SUFFIX(
tera,
"Ts")
131 _GLIBCXX_UNITS_SUFFIX(
peta,
"Ps")
132 _GLIBCXX_UNITS_SUFFIX(
exa,
"Es")
136#undef _GLIBCXX_UNITS_SUFFIX
137 return __detail::__units_suffix_misc<_Period>(__buf, __n);
146 template<
typename _CharT,
typename _Traits,
147 typename _Rep,
typename _Period>
152 using period =
typename _Period::type;
159 __s << __detail::__units_suffix<period, _CharT>(__buf,
sizeof(__buf));
168 template<
typename _Duration>
169 struct __local_time_fmt
172 const string* _M_abbrev;
176 struct __local_fmt_t;
189 template<
typename _Duration>
190 inline __detail::__local_time_fmt<_Duration>
192 const string* __abbrev =
nullptr,
193 const seconds* __offset_sec =
nullptr)
194 {
return {__time, __abbrev, __offset_sec}; }
202 [[noreturn,__gnu__::__always_inline__]]
204 __no_timezone_available()
205 { __throw_format_error(
"format error: no timezone available for %Z or %z"); }
207 [[noreturn,__gnu__::__always_inline__]]
209 __not_valid_for_duration()
210 { __throw_format_error(
"format error: chrono-format-spec not valid for "
211 "chrono::duration"); }
213 [[noreturn,__gnu__::__always_inline__]]
215 __invalid_chrono_spec()
216 { __throw_format_error(
"format error: chrono-format-spec not valid for "
219 template<
typename _CharT>
220 struct _ChronoSpec : _Spec<_CharT>
222 basic_string_view<_CharT> _M_chrono_specs;
229 _Year = 1, _Month = 2, _Day = 4, _Weekday = 8, _TimeOfDay = 16,
231 _Date = _Year | _Month | _Day | _Weekday,
232 _DateTime = _Date | _TimeOfDay,
233 _ZonedDateTime = _DateTime | _TimeZone,
237 constexpr _ChronoParts
238 operator|(_ChronoParts __x, _ChronoParts __y)
239 {
return static_cast<_ChronoParts
>((int)__x | (
int)__y); }
242 template<
typename _CharT>
243 struct __formatter_chrono
245 using __string_view = basic_string_view<_CharT>;
246 using __string = basic_string<_CharT>;
248 template<
typename _ParseContext>
249 constexpr typename _ParseContext::iterator
250 _M_parse(_ParseContext& __pc, _ChronoParts __parts)
252 auto __first = __pc.
begin();
253 auto __last = __pc.end();
255 _ChronoSpec<_CharT> __spec{};
257 auto __finalize = [
this, &__spec] {
261 auto __finished = [&] {
262 if (__first == __last || *__first ==
'}')
273 __first = __spec._M_parse_fill_and_align(__first, __last);
277 __first = __spec._M_parse_width(__first, __last, __pc);
281 if (__parts & _ChronoParts::_Duration)
283 __first = __spec._M_parse_precision(__first, __last, __pc);
288 __first = __spec._M_parse_locale(__first, __last);
295 __string_view __str(__first, __last - __first);
296 auto __end = __str.find(
'}');
297 if (__end != __str.npos)
299 __str.remove_suffix(__str.length() - __end);
300 __last = __first + __end;
302 if (__str.find(
'{') != __str.npos)
303 __throw_format_error(
"chrono format error: '{' in chrono-specs");
310 const auto __chrono_specs = __first++;
311 if (*__chrono_specs !=
'%')
312 __throw_format_error(
"chrono format error: no '%' at start of "
319 while (__first != __last)
321 enum _Mods { _Mod_none, _Mod_E, _Mod_O, _Mod_E_O };
322 _Mods __allowed_mods = _Mod_none;
324 _CharT __c = *__first++;
337 __needed = _DateTime;
338 __allowed_mods = _Mod_E;
342 __allowed_mods = _Mod_E;
347 __allowed_mods = _Mod_O;
359 __needed = _TimeOfDay;
360 __allowed_mods = _Mod_O;
363 if (!(__parts & _Duration))
368 __allowed_mods = _Mod_O;
371 __needed = _TimeOfDay;
372 __allowed_mods = _Mod_O;
378 __needed = _TimeOfDay;
382 __needed = _Duration;
385 __needed = _TimeOfDay;
386 __allowed_mods = _Mod_O;
391 __allowed_mods = _Mod_O;
397 __allowed_mods = _Mod_O;
401 __allowed_mods = _Mod_E;
404 __needed = _TimeOfDay;
405 __allowed_mods = _Mod_E;
409 __allowed_mods = _Mod_E_O;
413 __allowed_mods = _Mod_E;
416 __needed = _TimeZone;
417 __allowed_mods = _Mod_E_O;
420 __needed = _TimeZone;
428 if (__mod) [[unlikely]]
430 __allowed_mods = _Mod_none;
436 __throw_format_error(
"chrono format error: invalid "
437 " specifier in chrono-specs");
440 if ((__mod ==
'E' && !(__allowed_mods & _Mod_E))
441 || (__mod ==
'O' && !(__allowed_mods & _Mod_O)))
442 __throw_format_error(
"chrono format error: invalid "
443 " modifier in chrono-specs");
446 if ((__parts & __needed) != __needed)
447 __throw_format_error(
"chrono format error: format argument "
448 "does not contain the information "
449 "required by the chrono-specs");
452 size_t __pos = __string_view(__first, __last - __first).find(
'%');
457 if (__pos == __string_view::npos)
463 __first += __pos + 1;
468 if (__conv || __mod != _CharT())
469 __throw_format_error(
"chrono format error: unescaped '%' in "
473 _M_spec._M_chrono_specs
474 = __string_view(__chrono_specs, __first - __chrono_specs);
484 template<
typename _Tp,
typename _FormatContext>
485 typename _FormatContext::iterator
486 _M_format(
const _Tp& __t, _FormatContext& __fc,
487 bool __is_neg =
false)
const
489 auto __first = _M_spec._M_chrono_specs.begin();
490 const auto __last = _M_spec._M_chrono_specs.end();
491 if (__first == __last)
492 return _M_format_to_ostream(__t, __fc, __is_neg);
494 _Sink_iter<_CharT> __out;
495 __format::_Str_sink<_CharT> __sink;
496 bool __write_direct =
false;
497 if constexpr (is_same_v<
typename _FormatContext::iterator,
500 if (_M_spec._M_width_kind == __format::_WP_none)
503 __write_direct =
true;
506 __out = __sink.out();
509 __out = __sink.out();
513 if constexpr (__is_specialization_of<_Tp, chrono::hh_mm_ss>)
514 __is_neg = __t.is_negative();
516 auto __print_sign = [&__is_neg, &__out] {
517 if constexpr (chrono::__is_duration_v<_Tp>
518 || __is_specialization_of<_Tp, chrono::hh_mm_ss>)
521 *__out++ = _S_plus_minus[1];
528 constexpr const _CharT* __literals = _GLIBCXX_WIDEN(
"\n\t%");
535 _CharT __c = *__first++;
540 __out = _M_a_A(__t,
std::move(__out), __fc, __c ==
'A');
545 __out = _M_b_B(__t,
std::move(__out), __fc, __c ==
'B');
548 __out = _M_c(__t,
std::move(__out), __fc, __mod ==
'E');
553 __out = _M_C_y_Y(__t,
std::move(__out), __fc, __c, __mod);
557 __out = _M_d_e(__t,
std::move(__out), __fc, __c, __mod ==
'O');
560 __out = _M_D(__t,
std::move(__out), __fc);
563 __out = _M_F(__t,
std::move(__out), __fc);
567 __out = _M_g_G(__t,
std::move(__out), __fc, __c ==
'G');
571 __out = _M_H_I(__t, __print_sign(), __fc, __c, __mod ==
'O');
574 __out = _M_j(__t, __print_sign(), __fc);
577 __out = _M_m(__t,
std::move(__out), __fc, __mod ==
'O');
580 __out = _M_M(__t, __print_sign(), __fc, __mod ==
'O');
583 __out = _M_p(__t,
std::move(__out), __fc);
586 __out = _M_q(__t,
std::move(__out), __fc);
590 if constexpr (chrono::__is_duration_v<_Tp>)
591 __out = std::format_to(__print_sign(), _S_empty_spec,
594 __throw_format_error(
"chrono format error: argument is "
598 __out = _M_r(__t, __print_sign(), __fc);
602 __out = _M_R_T(__t, __print_sign(), __fc, __c ==
'T');
605 __out = _M_S(__t, __print_sign(), __fc, __mod ==
'O');
609 __out = _M_u_w(__t,
std::move(__out), __fc, __c, __mod ==
'O');
614 __out = _M_U_V_W(__t,
std::move(__out), __fc, __c,
618 __out = _M_x(__t,
std::move(__out), __fc, __mod ==
'E');
621 __out = _M_X(__t, __print_sign(), __fc, __mod ==
'E');
624 __out = _M_z(__t,
std::move(__out), __fc, (
bool)__mod);
627 __out = _M_Z(__t,
std::move(__out), __fc);
630 *__out++ = __literals[0];
633 *__out++ = __literals[1];
636 *__out++ = __literals[2];
648 __string_view __str(__first, __last - __first);
649 size_t __pos = __str.find(
'%');
654 if (__pos == __str.npos)
658 __str.remove_suffix(__str.length() - __pos);
659 __first += __pos + 1;
661 __out = __format::__write(
std::move(__out), __str);
664 while (__first != __last);
666 if constexpr (is_same_v<
typename _FormatContext::iterator,
672 return __format::__write_padded_as_spec(__str, __str.size(),
676 _ChronoSpec<_CharT> _M_spec;
680 template<
typename _FormatContext>
682 _M_locale(_FormatContext& __fc)
const
684 if (!_M_spec._M_localized)
687 return __fc.locale();
695 template<
typename _Tp,
typename _FormatContext>
696 typename _FormatContext::iterator
697 _M_format_to_ostream(
const _Tp& __t, _FormatContext& __fc,
700 using ::std::chrono::__detail::__utc_leap_second;
701 using ::std::chrono::__detail::__local_time_fmt;
703 if constexpr (__is_specialization_of<_Tp, __local_time_fmt>)
704 return _M_format_to_ostream(__t._M_time, __fc,
false);
707 basic_ostringstream<_CharT> __os;
708 __os.imbue(_M_locale(__fc));
710 if constexpr (__is_specialization_of<_Tp, __utc_leap_second>)
711 __os << __t._M_date <<
' ' << __t._M_time;
712 else if constexpr (chrono::__is_time_point_v<_Tp>)
719 if constexpr (is_convertible_v<_Tp, chrono::sys_days>)
720 __os << _S_date(__t);
723 auto __days = chrono::floor<chrono::days>(__t);
724 __os << chrono::year_month_day(__days) <<
' '
725 << chrono::hh_mm_ss(__t - __days);
730 if constexpr (chrono::__is_duration_v<_Tp>)
731 if (__is_neg) [[unlikely]]
732 __os << _S_plus_minus[1];
737 return __format::__write_padded_as_spec(__str, __str.size(),
742 static constexpr const _CharT* _S_chars
743 = _GLIBCXX_WIDEN(
"0123456789+-:/ {}");
744 static constexpr const _CharT* _S_plus_minus = _S_chars + 10;
745 static constexpr _CharT _S_colon = _S_chars[12];
746 static constexpr _CharT _S_slash = _S_chars[13];
747 static constexpr _CharT _S_space = _S_chars[14];
748 static constexpr const _CharT* _S_empty_spec = _S_chars + 15;
750 template<
typename _Tp,
typename _FormatContext>
751 typename _FormatContext::iterator
752 _M_a_A(
const _Tp& __t,
typename _FormatContext::iterator __out,
753 _FormatContext& __ctx,
bool __full)
const
757 chrono::weekday __wd = _S_weekday(__t);
759 __throw_format_error(
"format error: invalid weekday");
761 locale __loc = _M_locale(__ctx);
762 const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
763 const _CharT* __days[7];
765 __tp._M_days(__days);
767 __tp._M_days_abbreviated(__days);
768 __string_view __str(__days[__wd.c_encoding()]);
769 return __format::__write(
std::move(__out), __str);
772 template<
typename _Tp,
typename _FormatContext>
773 typename _FormatContext::iterator
774 _M_b_B(
const _Tp& __t,
typename _FormatContext::iterator __out,
775 _FormatContext& __ctx,
bool __full)
const
779 chrono::month __m = _S_month(__t);
781 __throw_format_error(
"format error: invalid month");
782 locale __loc = _M_locale(__ctx);
783 const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
784 const _CharT* __months[12];
786 __tp._M_months(__months);
788 __tp._M_months_abbreviated(__months);
789 __string_view __str(__months[(
unsigned)__m - 1]);
790 return __format::__write(
std::move(__out), __str);
793 template<
typename _Tp,
typename _FormatContext>
794 typename _FormatContext::iterator
795 _M_c(
const _Tp& __tt,
typename _FormatContext::iterator __out,
796 _FormatContext& __ctx,
bool __mod =
false)
const
801 auto __t = _S_floor_seconds(__tt);
802 locale __loc = _M_locale(__ctx);
803 const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
804 const _CharT* __formats[2];
805 __tp._M_date_time_formats(__formats);
806 const _CharT* __rep = __formats[__mod];
808 __rep = _GLIBCXX_WIDEN(
"%a %b %e %H:%M:%S %Y");
809 basic_string<_CharT> __fmt(_S_empty_spec);
810 __fmt.insert(1u, 1u, _S_colon);
811 __fmt.insert(2u, __rep);
812 return std::vformat_to(
std::move(__out), __loc, __fmt,
813 std::make_format_args<_FormatContext>(__t));
816 template<
typename _Tp,
typename _FormatContext>
817 typename _FormatContext::iterator
818 _M_C_y_Y(
const _Tp& __t,
typename _FormatContext::iterator __out,
819 _FormatContext& __ctx, _CharT __conv, _CharT __mod = 0)
const
829 chrono::year __y = _S_year(__t);
831 if (__mod) [[unlikely]]
834 __tm.tm_year = (int)__y - 1900;
835 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
839 basic_string<_CharT> __s;
841 const bool __is_neg = __yi < 0;
842 __yi = __builtin_abs(__yi);
844 if (__conv ==
'Y' || __conv ==
'C')
846 int __ci = __yi / 100;
847 if (__is_neg) [[unlikely]]
849 __s.assign(1, _S_plus_minus[1]);
851 if (__conv ==
'C' && (__ci * 100) != __yi)
854 if (__ci >= 100) [[unlikely]]
856 __s += std::format(_S_empty_spec, __ci / 100);
859 __s += _S_two_digits(__ci);
862 if (__conv ==
'Y' || __conv ==
'y')
863 __s += _S_two_digits(__yi % 100);
865 return __format::__write(
std::move(__out), __string_view(__s));
868 template<
typename _Tp,
typename _FormatContext>
869 typename _FormatContext::iterator
870 _M_D(
const _Tp& __t,
typename _FormatContext::iterator __out,
871 _FormatContext&)
const
873 auto __ymd = _S_date(__t);
874 basic_string<_CharT> __s;
875#if ! _GLIBCXX_USE_CXX11_ABI
878 __s = _S_two_digits((
unsigned)__ymd.month());
880 __s += _S_two_digits((
unsigned)__ymd.day());
882 __s += _S_two_digits(__builtin_abs((
int)__ymd.year()) % 100);
883 return __format::__write(
std::move(__out), __string_view(__s));
886 template<
typename _Tp,
typename _FormatContext>
887 typename _FormatContext::iterator
888 _M_d_e(
const _Tp& __t,
typename _FormatContext::iterator __out,
889 _FormatContext& __ctx, _CharT __conv,
bool __mod =
false)
const
896 chrono::day __d = _S_day(__t);
897 unsigned __i = (unsigned)__d;
899 if (__mod) [[unlikely]]
903 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
907 auto __sv = _S_two_digits(__i);
909 if (__conv == _CharT(
'e') && __i < 10)
915 return __format::__write(
std::move(__out), __sv);
918 template<
typename _Tp,
typename _FormatContext>
919 typename _FormatContext::iterator
920 _M_F(
const _Tp& __t,
typename _FormatContext::iterator __out,
921 _FormatContext&)
const
923 auto __ymd = _S_date(__t);
924 basic_string<_CharT> __s;
925#if ! _GLIBCXX_USE_CXX11_ABI
928 __s += std::format(_GLIBCXX_WIDEN(
"{:04d}- - "), (
int)__ymd.year());
929 auto __sv = _S_two_digits((
unsigned)__ymd.month());
930 __s[__s.size() - 5] = __sv[0];
931 __s[__s.size() - 4] = __sv[1];
932 __sv = _S_two_digits((
unsigned)__ymd.day());
933 __s[__s.size() - 2] = __sv[0];
934 __s[__s.size() - 1] = __sv[1];
936 return __format::__write(
std::move(__out), __sv);
939 template<
typename _Tp,
typename _FormatContext>
940 typename _FormatContext::iterator
941 _M_g_G(
const _Tp& __t,
typename _FormatContext::iterator __out,
942 _FormatContext& __ctx,
bool __full)
const
946 using namespace chrono;
947 auto __d = _S_days(__t);
949 __d -= (weekday(__d) - Monday) -
days(3);
951 year __y = year_month_day(__d).year();
952 return _M_C_y_Y(__y,
std::move(__out), __ctx,
"yY"[__full]);
955 template<
typename _Tp,
typename _FormatContext>
956 typename _FormatContext::iterator
957 _M_H_I(
const _Tp& __t,
typename _FormatContext::iterator __out,
958 _FormatContext& __ctx, _CharT __conv,
bool __mod =
false)
const
965 const auto __hms = _S_hms(__t);
966 int __i = __hms.hours().count();
968 if (__mod) [[unlikely]]
972 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
976 if (__conv == _CharT(
'I'))
983 return __format::__write(
std::move(__out), _S_two_digits(__i));
986 template<
typename _Tp,
typename _FormatContext>
987 typename _FormatContext::iterator
988 _M_j(
const _Tp& __t,
typename _FormatContext::iterator __out,
989 _FormatContext&)
const
991 if constexpr (chrono::__is_duration_v<_Tp>)
994 unsigned __d = chrono::duration_cast<chrono::days>(__t).count();
995 return std::format_to(
std::move(__out), _S_empty_spec, __d);
1000 using namespace chrono;
1001 auto __day = _S_days(__t);
1002 auto __ymd = _S_date(__t);
1006 if constexpr (is_same_v<
typename decltype(__day)::clock, local_t>)
1007 __d = __day - local_days(__ymd.year()/January/0);
1009 __d = __day - sys_days(__ymd.year()/January/0);
1010 return std::format_to(
std::move(__out), _GLIBCXX_WIDEN(
"{:03d}"),
1015 template<
typename _Tp,
typename _FormatContext>
1016 typename _FormatContext::iterator
1017 _M_m(
const _Tp& __t,
typename _FormatContext::iterator __out,
1018 _FormatContext& __ctx,
bool __mod)
const
1023 auto __m = _S_month(__t);
1024 auto __i = (unsigned)__m;
1026 if (__mod) [[unlikely]]
1029 __tm.tm_mon = __i - 1;
1030 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
1034 return __format::__write(
std::move(__out), _S_two_digits(__i));
1037 template<
typename _Tp,
typename _FormatContext>
1038 typename _FormatContext::iterator
1039 _M_M(
const _Tp& __t,
typename _FormatContext::iterator __out,
1040 _FormatContext& __ctx,
bool __mod)
const
1045 auto __m = _S_hms(__t).minutes();
1046 auto __i = __m.count();
1048 if (__mod) [[unlikely]]
1052 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
1056 return __format::__write(
std::move(__out), _S_two_digits(__i));
1059 template<
typename _Tp,
typename _FormatContext>
1060 typename _FormatContext::iterator
1061 _M_p(
const _Tp& __t,
typename _FormatContext::iterator __out,
1062 _FormatContext& __ctx)
const
1065 auto __hms = _S_hms(__t);
1066 locale __loc = _M_locale(__ctx);
1067 const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
1068 const _CharT* __ampm[2];
1069 __tp._M_am_pm(__ampm);
1070 return std::format_to(
std::move(__out), _S_empty_spec,
1071 __ampm[__hms.hours().count() >= 12]);
1074 template<
typename _Tp,
typename _FormatContext>
1075 typename _FormatContext::iterator
1076 _M_q(
const _Tp&,
typename _FormatContext::iterator __out,
1077 _FormatContext& __ctx)
const
1080 if constexpr (!chrono::__is_duration_v<_Tp>)
1081 __throw_format_error(
"format error: argument is not a duration");
1084 using period =
typename _Tp::period;
1085 char __buf[
sizeof(
"[/]s") + 2 * numeric_limits<intmax_t>::digits10];
1086 constexpr size_t __n =
sizeof(__buf);
1087 auto __s = chrono::__detail::__units_suffix<period, _CharT>(__buf,
1089 if constexpr (is_same_v<
decltype(__s),
const _CharT*>)
1090 return std::format_to(
std::move(__out), _S_empty_spec, __s);
1095 size_t __len = __builtin_strlen(__buf);
1096 locale __loc = _M_locale(__ctx);
1097 auto& __ct = use_facet<ctype<_CharT>>(__loc);
1098 __ct.widen(__buf, __len, __wbuf);
1100 return std::format_to(
std::move(__out), _S_empty_spec,
1108 template<
typename _Tp,
typename _FormatContext>
1109 typename _FormatContext::iterator
1110 _M_r(
const _Tp& __tt,
typename _FormatContext::iterator __out,
1111 _FormatContext& __ctx)
const
1114 auto __t = _S_floor_seconds(__tt);
1115 locale __loc = _M_locale(__ctx);
1116 const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
1117 const _CharT* __ampm_fmt;
1118 __tp._M_am_pm_format(&__ampm_fmt);
1119 basic_string<_CharT> __fmt(_S_empty_spec);
1120 __fmt.insert(1u, 1u, _S_colon);
1121 __fmt.insert(2u, __ampm_fmt);
1122 return std::vformat_to(
std::move(__out), __fmt,
1123 std::make_format_args<_FormatContext>(__t));
1126 template<
typename _Tp,
typename _FormatContext>
1127 typename _FormatContext::iterator
1128 _M_R_T(
const _Tp& __t,
typename _FormatContext::iterator __out,
1129 _FormatContext& __ctx,
bool __secs)
const
1133 auto __hms = _S_hms(__t);
1135 basic_string<_CharT> __s;
1136#if ! _GLIBCXX_USE_CXX11_ABI
1139 __s = std::format(_GLIBCXX_WIDEN(
"{:02d}:00"), __hms.hours().count());
1140 auto __sv = _S_two_digits(__hms.minutes().count());
1141 __s[__s.size() - 2] = __sv[0];
1142 __s[__s.size() - 1] = __sv[1];
1144 __out = __format::__write(
std::move(__out), __sv);
1147 *__out++ = _S_colon;
1148 __out = _M_S(__hms,
std::move(__out), __ctx);
1153 template<
typename _Tp,
typename _FormatContext>
1154 typename _FormatContext::iterator
1155 _M_S(
const _Tp& __t,
typename _FormatContext::iterator __out,
1156 _FormatContext& __ctx,
bool __mod =
false)
const
1160 auto __hms = _S_hms(__t);
1162 if (__mod) [[unlikely]]
1165 __tm.tm_sec = (int)__hms.seconds().count();
1166 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
1170 if constexpr (__hms.fractional_width == 0)
1171 __out = __format::__write(
std::move(__out),
1172 _S_two_digits(__hms.seconds().count()));
1175 locale __loc = _M_locale(__ctx);
1176 auto __s = __hms.seconds();
1177 auto __ss = __hms.subseconds();
1178 using rep =
typename decltype(__ss)::rep;
1179 if constexpr (is_floating_point_v<rep>)
1181 chrono::duration<rep> __fs = __s + __ss;
1182 __out = std::format_to(
std::move(__out), __loc,
1183 _GLIBCXX_WIDEN(
"{:#0{}.{}Lf}"),
1185 3 + __hms.fractional_width,
1186 __hms.fractional_width);
1191 = use_facet<numpunct<_CharT>>(__loc);
1192 __out = __format::__write(
std::move(__out),
1193 _S_two_digits(__s.count()));
1194 *__out++ = __np.decimal_point();
1195 if constexpr (is_integral_v<rep>)
1196 __out = std::format_to(
std::move(__out),
1197 _GLIBCXX_WIDEN(
"{:0{}}"),
1199 __hms.fractional_width);
1202 auto __str = std::format(_S_empty_spec, __ss.count());
1203 __out = std::format_to(_GLIBCXX_WIDEN(
"{:0>{}s}"),
1205 __hms.fractional_width);
1214 template<
typename _Tp,
typename _FormatContext>
1215 typename _FormatContext::iterator
1216 _M_u_w(
const _Tp& __t,
typename _FormatContext::iterator __out,
1217 _FormatContext& __ctx, _CharT __conv,
bool __mod =
false)
const
1224 chrono::weekday __wd = _S_weekday(__t);
1226 if (__mod) [[unlikely]]
1229 __tm.tm_wday = __wd.c_encoding();
1230 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
1234 unsigned __wdi = __conv ==
'u' ? __wd.iso_encoding()
1235 : __wd.c_encoding();
1236 const _CharT __d = _S_digit(__wdi);
1237 return __format::__write(
std::move(__out), __string_view(&__d, 1));
1240 template<
typename _Tp,
typename _FormatContext>
1241 typename _FormatContext::iterator
1242 _M_U_V_W(
const _Tp& __t,
typename _FormatContext::iterator __out,
1243 _FormatContext& __ctx, _CharT __conv,
bool __mod =
false)
const
1251 using namespace chrono;
1252 auto __d = _S_days(__t);
1253 using _TDays =
decltype(__d);
1255 if (__mod) [[unlikely]]
1257 const year_month_day __ymd(__d);
1258 const year __y = __ymd.year();
1260 __tm.tm_year = (int)__y - 1900;
1261 __tm.tm_yday = (__d - _TDays(__y/January/1)).count();
1262 __tm.tm_wday = weekday(__d).c_encoding();
1263 return _M_locale_fmt(
std::move(__out), _M_locale(__ctx), __tm,
1271 __d -= (weekday(__d) - Monday) -
days(3);
1274 __first = _TDays(year_month_day(__d).year()/January/1);
1279 if constexpr (
requires { __t.year(); })
1282 __y = year_month_day(__d).year();
1283 const weekday __weekstart = __conv ==
'U' ? Sunday : Monday;
1284 __first = _TDays(__y/January/__weekstart[1]);
1286 auto __weeks = chrono::floor<weeks>(__d - __first);
1287 __string_view __sv = _S_two_digits(__weeks.count() + 1);
1288 return __format::__write(
std::move(__out), __sv);
1291 template<
typename _Tp,
typename _FormatContext>
1292 typename _FormatContext::iterator
1293 _M_x(
const _Tp& __t,
typename _FormatContext::iterator __out,
1294 _FormatContext& __ctx,
bool __mod =
false)
const
1298 locale __loc = _M_locale(__ctx);
1299 const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
1300 const _CharT* __date_reps[2];
1301 __tp._M_date_formats(__date_reps);
1302 const _CharT* __rep = __date_reps[__mod];
1304 return _M_D(__t,
std::move(__out), __ctx);
1306 basic_string<_CharT> __fmt(_S_empty_spec);
1307 __fmt.insert(1u, 1u, _S_colon);
1308 __fmt.insert(2u, __rep);
1309 return std::vformat_to(
std::move(__out), __fmt,
1310 std::make_format_args<_FormatContext>(__t));
1313 template<
typename _Tp,
typename _FormatContext>
1314 typename _FormatContext::iterator
1315 _M_X(
const _Tp& __tt,
typename _FormatContext::iterator __out,
1316 _FormatContext& __ctx,
bool __mod =
false)
const
1320 auto __t = _S_floor_seconds(__tt);
1321 locale __loc = _M_locale(__ctx);
1322 const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
1323 const _CharT* __time_reps[2];
1324 __tp._M_time_formats(__time_reps);
1325 const _CharT* __rep = __time_reps[__mod];
1327 return _M_R_T(__t,
std::move(__out), __ctx,
true);
1329 basic_string<_CharT> __fmt(_S_empty_spec);
1330 __fmt.insert(1u, 1u, _S_colon);
1331 __fmt.insert(2u, __rep);
1332 return std::vformat_to(
std::move(__out), __fmt,
1333 std::make_format_args<_FormatContext>(__t));
1336 template<
typename _Tp,
typename _FormatContext>
1337 typename _FormatContext::iterator
1338 _M_z(
const _Tp& __t,
typename _FormatContext::iterator __out,
1339 _FormatContext&,
bool __mod =
false)
const
1341 using ::std::chrono::__detail::__utc_leap_second;
1342 using ::std::chrono::__detail::__local_time_fmt;
1344 auto __utc = __mod ? __string_view(_GLIBCXX_WIDEN(
"+00:00"), 6)
1345 : __string_view(_GLIBCXX_WIDEN(
"+0000"), 5);
1347 if constexpr (chrono::__is_time_point_v<_Tp>)
1349 if constexpr (is_same_v<
typename _Tp::clock,
1350 chrono::system_clock>)
1351 return __format::__write(
std::move(__out), __utc);
1353 else if constexpr (__is_specialization_of<_Tp, __local_time_fmt>)
1355 if (__t._M_offset_sec)
1358 basic_string<_CharT> __s;
1359 if (*__t._M_offset_sec != 0s)
1361 chrono:: hh_mm_ss __hms(*__t._M_offset_sec);
1362 __s = _S_plus_minus[__hms.is_negative()];
1363 __s += _S_two_digits(__hms.hours().count());
1366 __s += _S_two_digits(__hms.minutes().count());
1369 return __format::__write(
std::move(__out), __sv);
1372 else if constexpr (__is_specialization_of<_Tp, __utc_leap_second>)
1373 return __format::__write(
std::move(__out), __utc);
1375 __no_timezone_available();
1378 template<
typename _Tp,
typename _FormatContext>
1379 typename _FormatContext::iterator
1380 _M_Z(
const _Tp& __t,
typename _FormatContext::iterator __out,
1381 _FormatContext& __ctx)
const
1383 using ::std::chrono::__detail::__utc_leap_second;
1384 using ::std::chrono::__detail::__local_time_fmt;
1386 __string_view __utc(_GLIBCXX_WIDEN(
"UTC"), 3);
1387 if constexpr (chrono::__is_time_point_v<_Tp>)
1389 if constexpr (is_same_v<
typename _Tp::clock,
1390 chrono::system_clock>)
1391 return __format::__write(
std::move(__out), __utc);
1393 else if constexpr (__is_specialization_of<_Tp, __local_time_fmt>)
1397 __string_view __wsv;
1398 if constexpr (is_same_v<_CharT, char>)
1399 __wsv = *__t._M_abbrev;
1402 string_view __sv = *__t._M_abbrev;
1403 basic_string<_CharT> __ws(__sv.size(), _CharT());
1404 auto& __ct = use_facet<ctype<_CharT>>(_M_locale(__ctx));
1405 __ct.widen(__sv.begin(), __sv.end(), __ws.data());
1408 return __format::__write(
std::move(__out), __wsv);
1411 else if constexpr (__is_specialization_of<_Tp, __utc_leap_second>)
1412 return __format::__write(
std::move(__out), __utc);
1414 __no_timezone_available();
1421 _S_digit(
int __n)
noexcept
1424 return _GLIBCXX_WIDEN(
"0123456789999999")[__n & 0xf];
1428 static basic_string_view<_CharT>
1429 _S_two_digits(
int __n)
noexcept
1432 _GLIBCXX_WIDEN(
"0001020304050607080910111213141516171819"
1433 "2021222324252627282930313233343536373839"
1434 "4041424344454647484950515253545556575859"
1435 "6061626364656667686970717273747576777879"
1436 "8081828384858687888990919293949596979899"
1437 "9999999999999999999999999999999999999999"
1438 "9999999999999999") + 2 * (__n & 0x7f),
1446 template<
typename _Tp>
1447 static decltype(
auto)
1448 _S_hms(
const _Tp& __t)
1450 using ::std::chrono::__detail::__utc_leap_second;
1451 using ::std::chrono::__detail::__local_time_fmt;
1453 if constexpr (__is_specialization_of<_Tp, chrono::hh_mm_ss>)
1455 else if constexpr (__is_specialization_of<_Tp, __utc_leap_second>)
1457 else if constexpr (chrono::__is_duration_v<_Tp>)
1458 return chrono::hh_mm_ss<_Tp>(__t);
1459 else if constexpr (chrono::__is_time_point_v<_Tp>)
1460 return chrono::hh_mm_ss(__t - chrono::floor<chrono::days>(__t));
1461 else if constexpr (__is_specialization_of<_Tp, __local_time_fmt>)
1462 return _S_hms(__t._M_time);
1465 __invalid_chrono_spec();
1466 return chrono::hh_mm_ss<chrono::seconds>();
1471 template<
typename _Tp>
1473 _S_days(
const _Tp& __t)
1475 using namespace chrono;
1476 using ::std::chrono::__detail::__utc_leap_second;
1477 using ::std::chrono::__detail::__local_time_fmt;
1479 if constexpr (__is_time_point_v<_Tp>)
1480 return chrono::floor<days>(__t);
1481 else if constexpr (__is_specialization_of<_Tp, __utc_leap_second>)
1483 else if constexpr (__is_specialization_of<_Tp, __local_time_fmt>)
1484 return chrono::floor<days>(__t._M_time);
1485 else if constexpr (is_same_v<_Tp, year_month_day>
1486 || is_same_v<_Tp, year_month_day_last>
1487 || is_same_v<_Tp, year_month_weekday>
1488 || is_same_v<_Tp, year_month_weekday_last>)
1489 return sys_days(__t);
1492 if constexpr (__is_duration_v<_Tp>)
1493 __not_valid_for_duration();
1495 __invalid_chrono_spec();
1496 return chrono::sys_days();
1501 template<
typename _Tp>
1502 static chrono::year_month_day
1503 _S_date(
const _Tp& __t)
1505 if constexpr (is_same_v<_Tp, chrono::year_month_day>)
1508 return chrono::year_month_day(_S_days(__t));
1511 template<
typename _Tp>
1513 _S_day(
const _Tp& __t)
1515 using namespace chrono;
1517 if constexpr (is_same_v<_Tp, day>)
1519 else if constexpr (
requires { __t.day(); })
1522 return _S_date(__t).day();
1525 template<
typename _Tp>
1526 static chrono::month
1527 _S_month(
const _Tp& __t)
1529 using namespace chrono;
1531 if constexpr (is_same_v<_Tp, month>)
1533 else if constexpr (
requires { __t.month(); })
1536 return _S_date(__t).month();
1539 template<
typename _Tp>
1541 _S_year(
const _Tp& __t)
1543 using namespace chrono;
1545 if constexpr (is_same_v<_Tp, year>)
1547 else if constexpr (
requires { __t.year(); })
1550 return _S_date(__t).year();
1553 template<
typename _Tp>
1554 static chrono::weekday
1555 _S_weekday(
const _Tp& __t)
1558 using ::std::chrono::__detail::__local_time_fmt;
1560 if constexpr (is_same_v<_Tp, weekday>)
1562 else if constexpr (
requires { __t.weekday(); })
1564 else if constexpr (is_same_v<_Tp, month_weekday>)
1565 return __t.weekday_indexed().weekday();
1566 else if constexpr (is_same_v<_Tp, month_weekday_last>)
1567 return __t.weekday_last().weekday();
1569 return weekday(_S_days(__t));
1573 template<
typename _Tp>
1575 _S_floor_seconds(
const _Tp& __t)
1577 using chrono::__detail::__local_time_fmt;
1578 if constexpr (chrono::__is_time_point_v<_Tp>
1579 || chrono::__is_duration_v<_Tp>)
1581 if constexpr (_Tp::period::den != 1)
1582 return chrono::floor<chrono::seconds>(__t);
1586 else if constexpr (__is_specialization_of<_Tp, chrono::hh_mm_ss>)
1588 if constexpr (_Tp::fractional_width != 0)
1589 return chrono::floor<chrono::seconds>(__t.to_duration());
1593 else if constexpr (__is_specialization_of<_Tp, __local_time_fmt>)
1594 return _S_floor_seconds(__t._M_time);
1601 template<
typename _Iter>
1603 _M_locale_fmt(_Iter __out,
const locale& __loc,
const struct tm& __tm,
1604 char __fmt,
char __mod)
const
1606 basic_ostringstream<_CharT> __os;
1607 const auto& __tp = use_facet<time_put<_CharT>>(__loc);
1608 __tp.put(__os, __os, _S_space, &__tm, __fmt, __mod);
1610 __out = __format::__write(
std::move(__out), __os.view());
1618 template<
typename _Rep,
typename _Period,
typename _CharT>
1619 struct formatter<chrono::duration<_Rep, _Period>, _CharT>
1621 constexpr typename basic_format_parse_context<_CharT>::iterator
1622 parse(basic_format_parse_context<_CharT>& __pc)
1624 using namespace __format;
1625 auto __it = _M_f._M_parse(__pc, _Duration|_TimeOfDay);
1626 if constexpr (!is_floating_point_v<_Rep>)
1627 if (_M_f._M_spec._M_prec_kind != __format::_WP_none)
1628 __throw_format_error(
"format error: invalid precision for duration");
1632 template<
typename _Out>
1633 typename basic_format_context<_Out, _CharT>::iterator
1634 format(
const chrono::duration<_Rep, _Period>& __d,
1635 basic_format_context<_Out, _CharT>& __fc)
const
1637 return _M_f._M_format(chrono::abs(__d), __fc, __d < __d.zero());
1641 __format::__formatter_chrono<_CharT> _M_f;
1644 template<
typename _CharT>
1645 struct formatter<chrono::day, _CharT>
1647 template<
typename _ParseContext>
1648 constexpr typename _ParseContext::iterator
1649 parse(_ParseContext& __pc)
1650 {
return _M_f._M_parse(__pc, __format::_Day); }
1652 template<
typename _FormatContext>
1653 typename _FormatContext::iterator
1654 format(
const chrono::day& __t, _FormatContext& __fc)
const
1655 {
return _M_f._M_format(__t, __fc); }
1658 __format::__formatter_chrono<_CharT> _M_f;
1661 template<
typename _CharT>
1662 struct formatter<chrono::month, _CharT>
1664 template<
typename _ParseContext>
1665 constexpr typename _ParseContext::iterator
1666 parse(_ParseContext& __pc)
1667 {
return _M_f._M_parse(__pc, __format::_Month); }
1669 template<
typename _FormatContext>
1670 typename _FormatContext::iterator
1671 format(
const chrono::month& __t, _FormatContext& __fc)
const
1672 {
return _M_f._M_format(__t, __fc); }
1675 __format::__formatter_chrono<_CharT> _M_f;
1678 template<
typename _CharT>
1679 struct formatter<chrono::year, _CharT>
1681 template<
typename _ParseContext>
1682 constexpr typename _ParseContext::iterator
1683 parse(_ParseContext& __pc)
1684 {
return _M_f._M_parse(__pc, __format::_Year); }
1686 template<
typename _FormatContext>
1687 typename _FormatContext::iterator
1688 format(
const chrono::year& __t, _FormatContext& __fc)
const
1689 {
return _M_f._M_format(__t, __fc); }
1692 __format::__formatter_chrono<_CharT> _M_f;
1695 template<
typename _CharT>
1696 struct formatter<chrono::weekday, _CharT>
1698 template<
typename _ParseContext>
1699 constexpr typename _ParseContext::iterator
1700 parse(_ParseContext& __pc)
1701 {
return _M_f._M_parse(__pc, __format::_Weekday); }
1703 template<
typename _FormatContext>
1704 typename _FormatContext::iterator
1705 format(
const chrono::weekday& __t, _FormatContext& __fc)
const
1706 {
return _M_f._M_format(__t, __fc); }
1709 __format::__formatter_chrono<_CharT> _M_f;
1712 template<
typename _CharT>
1713 struct formatter<chrono::weekday_indexed, _CharT>
1715 template<
typename _ParseContext>
1716 constexpr typename _ParseContext::iterator
1717 parse(_ParseContext& __pc)
1718 {
return _M_f._M_parse(__pc, __format::_Weekday); }
1720 template<
typename _FormatContext>
1721 typename _FormatContext::iterator
1722 format(
const chrono::weekday_indexed& __t, _FormatContext& __fc)
const
1723 {
return _M_f._M_format(__t, __fc); }
1726 __format::__formatter_chrono<_CharT> _M_f;
1729 template<
typename _CharT>
1730 struct formatter<chrono::weekday_last, _CharT>
1732 template<
typename _ParseContext>
1733 constexpr typename _ParseContext::iterator
1734 parse(_ParseContext& __pc)
1735 {
return _M_f._M_parse(__pc, __format::_Weekday); }
1737 template<
typename _FormatContext>
1738 typename _FormatContext::iterator
1739 format(
const chrono::weekday_last& __t, _FormatContext& __fc)
const
1740 {
return _M_f._M_format(__t, __fc); }
1743 __format::__formatter_chrono<_CharT> _M_f;
1746 template<
typename _CharT>
1747 struct formatter<chrono::month_day, _CharT>
1749 template<
typename _ParseContext>
1750 constexpr typename _ParseContext::iterator
1751 parse(_ParseContext& __pc)
1752 {
return _M_f._M_parse(__pc, __format::_Month|__format::_Day); }
1754 template<
typename _FormatContext>
1755 typename _FormatContext::iterator
1756 format(
const chrono::month_day& __t, _FormatContext& __fc)
const
1757 {
return _M_f._M_format(__t, __fc); }
1760 __format::__formatter_chrono<_CharT> _M_f;
1763 template<
typename _CharT>
1764 struct formatter<chrono::month_day_last, _CharT>
1766 template<
typename _ParseContext>
1767 constexpr typename _ParseContext::iterator
1768 parse(_ParseContext& __pc)
1769 {
return _M_f._M_parse(__pc, __format::_Month|__format::_Day); }
1771 template<
typename _FormatContext>
1772 typename _FormatContext::iterator
1773 format(
const chrono::month_day_last& __t, _FormatContext& __fc)
const
1774 {
return _M_f._M_format(__t, __fc); }
1777 __format::__formatter_chrono<_CharT> _M_f;
1780 template<
typename _CharT>
1781 struct formatter<chrono::month_weekday, _CharT>
1783 template<
typename _ParseContext>
1784 constexpr typename _ParseContext::iterator
1785 parse(_ParseContext& __pc)
1786 {
return _M_f._M_parse(__pc, __format::_Month|__format::_Weekday); }
1788 template<
typename _FormatContext>
1789 typename _FormatContext::iterator
1790 format(
const chrono::month_weekday& __t, _FormatContext& __fc)
const
1791 {
return _M_f._M_format(__t, __fc); }
1794 __format::__formatter_chrono<_CharT> _M_f;
1797 template<
typename _CharT>
1798 struct formatter<chrono::month_weekday_last, _CharT>
1800 template<
typename _ParseContext>
1801 constexpr typename _ParseContext::iterator
1802 parse(_ParseContext& __pc)
1803 {
return _M_f._M_parse(__pc, __format::_Month|__format::_Weekday); }
1805 template<
typename _FormatContext>
1806 typename _FormatContext::iterator
1807 format(
const chrono::month_weekday_last& __t,
1808 _FormatContext& __fc)
const
1809 {
return _M_f._M_format(__t, __fc); }
1812 __format::__formatter_chrono<_CharT> _M_f;
1815 template<
typename _CharT>
1816 struct formatter<chrono::year_month, _CharT>
1818 template<
typename _ParseContext>
1819 constexpr typename _ParseContext::iterator
1820 parse(_ParseContext& __pc)
1821 {
return _M_f._M_parse(__pc, __format::_Year|__format::_Month); }
1823 template<
typename _FormatContext>
1824 typename _FormatContext::iterator
1825 format(
const chrono::year_month& __t, _FormatContext& __fc)
const
1826 {
return _M_f._M_format(__t, __fc); }
1829 __format::__formatter_chrono<_CharT> _M_f;
1832 template<
typename _CharT>
1833 struct formatter<chrono::year_month_day, _CharT>
1835 template<
typename _ParseContext>
1836 constexpr typename _ParseContext::iterator
1837 parse(_ParseContext& __pc)
1838 {
return _M_f._M_parse(__pc, __format::_Date); }
1840 template<
typename _FormatContext>
1841 typename _FormatContext::iterator
1842 format(
const chrono::year_month_day& __t, _FormatContext& __fc)
const
1843 {
return _M_f._M_format(__t, __fc); }
1846 __format::__formatter_chrono<_CharT> _M_f;
1849 template<
typename _CharT>
1850 struct formatter<chrono::year_month_day_last, _CharT>
1852 template<
typename _ParseContext>
1853 constexpr typename _ParseContext::iterator
1854 parse(_ParseContext& __pc)
1855 {
return _M_f._M_parse(__pc, __format::_Date); }
1857 template<
typename _FormatContext>
1858 typename _FormatContext::iterator
1859 format(
const chrono::year_month_day_last& __t,
1860 _FormatContext& __fc)
const
1861 {
return _M_f._M_format(__t, __fc); }
1864 __format::__formatter_chrono<_CharT> _M_f;
1867 template<
typename _CharT>
1868 struct formatter<chrono::year_month_weekday, _CharT>
1870 template<
typename _ParseContext>
1871 constexpr typename _ParseContext::iterator
1872 parse(_ParseContext& __pc)
1873 {
return _M_f._M_parse(__pc, __format::_Date); }
1875 template<
typename _FormatContext>
1876 typename _FormatContext::iterator
1877 format(
const chrono::year_month_weekday& __t,
1878 _FormatContext& __fc)
const
1879 {
return _M_f._M_format(__t, __fc); }
1882 __format::__formatter_chrono<_CharT> _M_f;
1885 template<
typename _CharT>
1886 struct formatter<chrono::year_month_weekday_last, _CharT>
1888 template<
typename _ParseContext>
1889 constexpr typename _ParseContext::iterator
1890 parse(_ParseContext& __pc)
1891 {
return _M_f._M_parse(__pc, __format::_Date); }
1893 template<
typename _FormatContext>
1894 typename _FormatContext::iterator
1895 format(
const chrono::year_month_weekday_last& __t,
1896 _FormatContext& __fc)
const
1897 {
return _M_f._M_format(__t, __fc); }
1900 __format::__formatter_chrono<_CharT> _M_f;
1903 template<
typename _Rep,
typename _Period,
typename _CharT>
1904 struct formatter<chrono::hh_mm_ss<chrono::duration<_Rep, _Period>>, _CharT>
1906 template<
typename _ParseContext>
1907 constexpr typename _ParseContext::iterator
1908 parse(_ParseContext& __pc)
1909 {
return _M_f._M_parse(__pc, __format::_TimeOfDay); }
1911 template<
typename _FormatContext>
1912 typename _FormatContext::iterator
1913 format(
const chrono::hh_mm_ss<chrono::duration<_Rep, _Period>>& __t,
1914 _FormatContext& __fc)
const
1915 {
return _M_f._M_format(__t, __fc); }
1918 __format::__formatter_chrono<_CharT> _M_f;
1921#if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
1922 template<
typename _CharT>
1923 struct formatter<chrono::sys_info, _CharT>
1925 template<
typename _ParseContext>
1926 constexpr typename _ParseContext::iterator
1927 parse(_ParseContext& __pc)
1928 {
return _M_f._M_parse(__pc, __format::_ChronoParts{}); }
1930 template<
typename _FormatContext>
1931 typename _FormatContext::iterator
1932 format(
const chrono::sys_info& __i, _FormatContext& __fc)
const
1933 {
return _M_f._M_format(__i, __fc); }
1936 __format::__formatter_chrono<_CharT> _M_f;
1939 template<
typename _CharT>
1940 struct formatter<chrono::local_info, _CharT>
1942 template<
typename _ParseContext>
1943 constexpr typename _ParseContext::iterator
1944 parse(_ParseContext& __pc)
1945 {
return _M_f._M_parse(__pc, __format::_ChronoParts{}); }
1947 template<
typename _FormatContext>
1948 typename _FormatContext::iterator
1949 format(
const chrono::local_info& __i, _FormatContext& __fc)
const
1950 {
return _M_f._M_format(__i, __fc); }
1953 __format::__formatter_chrono<_CharT> _M_f;
1957 template<
typename _Duration,
typename _CharT>
1958 struct formatter<chrono::sys_time<_Duration>, _CharT>
1960 template<
typename _ParseContext>
1961 constexpr typename _ParseContext::iterator
1962 parse(_ParseContext& __pc)
1964 auto __next = _M_f._M_parse(__pc, __format::_ZonedDateTime);
1965 if constexpr (!__stream_insertable)
1966 if (_M_f._M_spec._M_chrono_specs.empty())
1967 __format::__invalid_chrono_spec();
1971 template<
typename _FormatContext>
1972 typename _FormatContext::iterator
1973 format(
const chrono::sys_time<_Duration>& __t,
1974 _FormatContext& __fc)
const
1975 {
return _M_f._M_format(__t, __fc); }
1978 static constexpr bool __stream_insertable
1979 =
requires (basic_ostream<_CharT>& __os,
1980 chrono::sys_time<_Duration> __t) { __os << __t; };
1982 __format::__formatter_chrono<_CharT> _M_f;
1985 template<
typename _Duration,
typename _CharT>
1986 struct formatter<chrono::utc_time<_Duration>, _CharT>
1987 : __format::__formatter_chrono<_CharT>
1989 template<
typename _ParseContext>
1990 constexpr typename _ParseContext::iterator
1991 parse(_ParseContext& __pc)
1992 {
return _M_f._M_parse(__pc, __format::_ZonedDateTime); }
1994 template<
typename _FormatContext>
1995 typename _FormatContext::iterator
1996 format(
const chrono::utc_time<_Duration>& __t,
1997 _FormatContext& __fc)
const
2002 using chrono::__detail::__utc_leap_second;
2003 using chrono::seconds;
2004 using chrono::sys_time;
2005 using _CDur = common_type_t<_Duration, seconds>;
2006 const auto __li = chrono::get_leap_second_info(__t);
2007 sys_time<_CDur> __s{__t.time_since_epoch() - __li.elapsed};
2008 if (!__li.is_leap_second) [[likely]]
2009 return _M_f._M_format(__s, __fc);
2011 return _M_f._M_format(__utc_leap_second(__s), __fc);
2015 friend formatter<chrono::__detail::__utc_leap_second<_Duration>, _CharT>;
2017 __format::__formatter_chrono<_CharT> _M_f;
2020 template<
typename _Duration,
typename _CharT>
2021 struct formatter<chrono::tai_time<_Duration>, _CharT>
2022 : __format::__formatter_chrono<_CharT>
2024 template<
typename _ParseContext>
2025 constexpr typename _ParseContext::iterator
2026 parse(_ParseContext& __pc)
2027 {
return _M_f._M_parse(__pc, __format::_ZonedDateTime); }
2029 template<
typename _FormatContext>
2030 typename _FormatContext::iterator
2031 format(
const chrono::tai_time<_Duration>& __t,
2032 _FormatContext& __fc)
const
2037 constexpr chrono::days __tai_offset = chrono::days(4383);
2038 using _CDur = common_type_t<_Duration, chrono::days>;
2039 chrono::local_time<_CDur> __lt(__t.time_since_epoch() - __tai_offset);
2040 const string __abbrev(
"TAI", 3);
2041 const chrono::seconds __off = 0s;
2042 const auto __lf = chrono::local_time_format(__lt, &__abbrev, &__off);
2043 return _M_f._M_format(__lf, __fc);
2047 __format::__formatter_chrono<_CharT> _M_f;
2050 template<
typename _Duration,
typename _CharT>
2051 struct formatter<chrono::gps_time<_Duration>, _CharT>
2052 : __format::__formatter_chrono<_CharT>
2054 template<
typename _ParseContext>
2055 constexpr typename _ParseContext::iterator
2056 parse(_ParseContext& __pc)
2057 {
return _M_f._M_parse(__pc, __format::_ZonedDateTime); }
2059 template<
typename _FormatContext>
2060 typename _FormatContext::iterator
2061 format(
const chrono::gps_time<_Duration>& __t,
2062 _FormatContext& __fc)
const
2067 constexpr chrono::days __gps_offset = chrono::days(3657);
2068 using _CDur = common_type_t<_Duration, chrono::days>;
2069 chrono::local_time<_CDur> __lt(__t.time_since_epoch() + __gps_offset);
2070 const string __abbrev(
"GPS", 3);
2071 const chrono::seconds __off = 0s;
2072 const auto __lf = chrono::local_time_format(__lt, &__abbrev, &__off);
2073 return _M_f._M_format(__lf, __fc);
2077 __format::__formatter_chrono<_CharT> _M_f;
2080 template<
typename _Duration,
typename _CharT>
2081 struct formatter<chrono::file_time<_Duration>, _CharT>
2083 template<
typename _ParseContext>
2084 constexpr typename _ParseContext::iterator
2085 parse(_ParseContext& __pc)
2086 {
return _M_f._M_parse(__pc, __format::_ZonedDateTime); }
2088 template<
typename _FormatContext>
2089 typename _FormatContext::iterator
2090 format(
const chrono::file_time<_Duration>& __t,
2091 _FormatContext& __ctx)
const
2093 using namespace chrono;
2094 return _M_f._M_format(chrono::clock_cast<system_clock>(__t), __ctx);
2098 __format::__formatter_chrono<_CharT> _M_f;
2101 template<
typename _Duration,
typename _CharT>
2102 struct formatter<chrono::local_time<_Duration>, _CharT>
2104 template<
typename _ParseContext>
2105 constexpr typename _ParseContext::iterator
2106 parse(_ParseContext& __pc)
2107 {
return _M_f._M_parse(__pc, __format::_DateTime); }
2109 template<
typename _FormatContext>
2110 typename _FormatContext::iterator
2111 format(
const chrono::local_time<_Duration>& __t,
2112 _FormatContext& __ctx)
const
2113 {
return _M_f._M_format(__t, __ctx); }
2116 __format::__formatter_chrono<_CharT> _M_f;
2119 template<
typename _Duration,
typename _CharT>
2120 struct formatter<chrono::__detail::__local_time_fmt<_Duration>, _CharT>
2122 template<
typename _ParseContext>
2123 constexpr typename _ParseContext::iterator
2124 parse(_ParseContext& __pc)
2125 {
return _M_f._M_parse(__pc, __format::_ZonedDateTime); }
2127 template<
typename _FormatContext>
2128 typename _FormatContext::iterator
2129 format(
const chrono::__detail::__local_time_fmt<_Duration>& __t,
2130 _FormatContext& __ctx)
const
2131 {
return _M_f._M_format(__t, __ctx); }
2134 __format::__formatter_chrono<_CharT> _M_f;
2137#if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
2138 template<
typename _Duration,
typename _TimeZonePtr,
typename _CharT>
2139 struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _CharT>
2140 : formatter<chrono::__detail::__local_time_fmt<_Duration>, _CharT>
2142 template<
typename _FormatContext>
2143 typename _FormatContext::iterator
2144 format(
const chrono::zoned_time<_Duration, _TimeZonePtr>& __tp,
2145 _FormatContext& __ctx)
const
2147 using chrono::__detail::__local_time_fmt;
2148 using _Base = formatter<__local_time_fmt<_Duration>, _CharT>;
2149 const chrono::sys_info __info = __tp.get_info();
2150 const auto __lf = chrono::local_time_format(__tp.get_local_time(),
2153 return _Base::format(__lf, __ctx);
2159 template<
typename _Duration,
typename _CharT>
2160 struct formatter<chrono::__detail::__utc_leap_second<_Duration>, _CharT>
2161 : formatter<chrono::utc_time<_Duration>, _CharT>
2163 template<
typename _FormatContext>
2164 typename _FormatContext::iterator
2165 format(
const chrono::__detail::__utc_leap_second<_Duration>& __t,
2166 _FormatContext& __fc)
const
2167 {
return this->_M_f._M_format(__t, __fc); }
2177 template<
typename _CharT,
typename _Traits,
typename _Rep,
typename _Period,
2178 typename _Alloc = allocator<_CharT>>
2179 basic_istream<_CharT, _Traits>&
2180 from_stream(basic_istream<_CharT, _Traits>& __is,
const _CharT* __fmt,
2181 duration<_Rep, _Period>& __d,
2182 basic_string<_CharT, _Traits, _Alloc>* __abbrev =
nullptr,
2183 minutes* __offset =
nullptr)
2188 template<
typename _CharT,
typename _Traits>
2189 inline basic_ostream<_CharT, _Traits>&
2190 operator<<(basic_ostream<_CharT, _Traits>& __os,
const day& __d)
2192 using _Ctx = __conditional_t<is_same_v<_CharT, char>,
2193 format_context, wformat_context>;
2194 using _Str = basic_string_view<_CharT>;
2195 _Str __s = _GLIBCXX_WIDEN(
"{:02d} is not a valid day");
2197 __s = __s.substr(0, 6);
2198 auto __u = (unsigned)__d;
2199 __os << std::vformat(__s, make_format_args<_Ctx>(__u));
2205 template<
typename _CharT,
typename _Traits>
2206 inline basic_ostream<_CharT, _Traits>&
2207 operator<<(basic_ostream<_CharT, _Traits>& __os,
const month& __m)
2209 using _Ctx = __conditional_t<is_same_v<_CharT, char>,
2210 format_context, wformat_context>;
2211 using _Str = basic_string_view<_CharT>;
2212 _Str __s = _GLIBCXX_WIDEN(
"{:L%b}{} is not a valid month");
2214 __os << std::vformat(__os.getloc(), __s.substr(0, 6),
2215 make_format_args<_Ctx>(__m));
2218 auto __u = (unsigned)__m;
2219 __os << std::vformat(__s.substr(6), make_format_args<_Ctx>(__u));
2226 template<
typename _CharT,
typename _Traits>
2227 inline basic_ostream<_CharT, _Traits>&
2228 operator<<(basic_ostream<_CharT, _Traits>& __os,
const year& __y)
2230 using _Ctx = __conditional_t<is_same_v<_CharT, char>,
2231 format_context, wformat_context>;
2232 using _Str = basic_string_view<_CharT>;
2233 _Str __s = _GLIBCXX_WIDEN(
"-{:04d} is not a valid year");
2235 __s = __s.substr(0, 7);
2237 if (__i >= 0) [[likely]]
2238 __s.remove_prefix(1);
2241 __os << std::vformat(__s, make_format_args<_Ctx>(__i));
2247 template<
typename _CharT,
typename _Traits>
2248 inline basic_ostream<_CharT, _Traits>&
2249 operator<<(basic_ostream<_CharT, _Traits>& __os,
const weekday& __wd)
2251 using _Ctx = __conditional_t<is_same_v<_CharT, char>,
2252 format_context, wformat_context>;
2253 using _Str = basic_string_view<_CharT>;
2254 _Str __s = _GLIBCXX_WIDEN(
"{:L%a}{} is not a valid weekday");
2256 __os << std::vformat(__os.getloc(), __s.substr(0, 6),
2257 make_format_args<_Ctx>(__wd));
2260 auto __c = __wd.c_encoding();
2261 __os << std::vformat(__s.substr(6), make_format_args<_Ctx>(__c));
2268 template<
typename _CharT,
typename _Traits>
2269 inline basic_ostream<_CharT, _Traits>&
2270 operator<<(basic_ostream<_CharT, _Traits>& __os,
2271 const weekday_indexed& __wdi)
2276 basic_stringstream<_CharT> __os2;
2277 __os2.imbue(__os.getloc());
2278 __os2 << __wdi.weekday();
2279 const auto __i = __wdi.index();
2280 if constexpr (is_same_v<_CharT, char>)
2281 __os2 << std::format(
"[{}", __i);
2283 __os2 << std::format(L
"[{}", __i);
2284 basic_string_view<_CharT> __s = _GLIBCXX_WIDEN(
" is not a valid index]");
2285 if (__i >= 1 && __i <= 5)
2286 __os2 << __s.back();
2289 __os << __os2.view();
2293 template<
typename _CharT,
typename _Traits>
2294 inline basic_ostream<_CharT, _Traits>&
2295 operator<<(basic_ostream<_CharT, _Traits>& __os,
2296 const weekday_last& __wdl)
2299 basic_stringstream<_CharT> __os2;
2300 __os2.imbue(__os.getloc());
2301 __os2 << __wdl.weekday() << _GLIBCXX_WIDEN(
"[last]");
2302 __os << __os2.view();
2306 template<
typename _CharT,
typename _Traits>
2307 inline basic_ostream<_CharT, _Traits>&
2308 operator<<(basic_ostream<_CharT, _Traits>& __os,
const month_day& __md)
2311 basic_stringstream<_CharT> __os2;
2312 __os2.imbue(__os.getloc());
2313 __os2 << __md.month();
2314 if constexpr (is_same_v<_CharT, char>)
2318 __os2 << __md.day();
2319 __os << __os2.view();
2325 template<
typename _CharT,
typename _Traits>
2326 inline basic_ostream<_CharT, _Traits>&
2327 operator<<(basic_ostream<_CharT, _Traits>& __os,
2328 const month_day_last& __mdl)
2331 basic_stringstream<_CharT> __os2;
2332 __os2.imbue(__os.getloc());
2333 __os2 << __mdl.month();
2334 if constexpr (is_same_v<_CharT, char>)
2338 __os << __os2.view();
2342 template<
typename _CharT,
typename _Traits>
2343 inline basic_ostream<_CharT, _Traits>&
2344 operator<<(basic_ostream<_CharT, _Traits>& __os,
2345 const month_weekday& __mwd)
2348 basic_stringstream<_CharT> __os2;
2349 __os2.imbue(__os.getloc());
2350 __os2 << __mwd.month();
2351 if constexpr (is_same_v<_CharT, char>)
2355 __os2 << __mwd.weekday_indexed();
2356 __os << __os2.view();
2360 template<
typename _CharT,
typename _Traits>
2361 inline basic_ostream<_CharT, _Traits>&
2362 operator<<(basic_ostream<_CharT, _Traits>& __os,
2363 const month_weekday_last& __mwdl)
2366 basic_stringstream<_CharT> __os2;
2367 __os2.imbue(__os.getloc());
2368 __os2 << __mwdl.month();
2369 if constexpr (is_same_v<_CharT, char>)
2373 __os2 << __mwdl.weekday_last();
2374 __os << __os2.view();
2378 template<
typename _CharT,
typename _Traits>
2379 inline basic_ostream<_CharT, _Traits>&
2380 operator<<(basic_ostream<_CharT, _Traits>& __os,
const year_month& __ym)
2383 basic_stringstream<_CharT> __os2;
2384 __os2.imbue(__os.getloc());
2385 __os2 << __ym.year();
2386 if constexpr (is_same_v<_CharT, char>)
2390 __os2 << __ym.month();
2391 __os << __os2.view();
2397 template<
typename _CharT,
typename _Traits>
2398 inline basic_ostream<_CharT, _Traits>&
2399 operator<<(basic_ostream<_CharT, _Traits>& __os,
2400 const year_month_day& __ymd)
2402 using _Ctx = __conditional_t<is_same_v<_CharT, char>,
2403 format_context, wformat_context>;
2404 using _Str = basic_string_view<_CharT>;
2405 _Str __s = _GLIBCXX_WIDEN(
"{:%F} is not a valid date");
2406 __os << std::vformat(__ymd.ok() ? __s.substr(0, 5) : __s,
2407 make_format_args<_Ctx>(__ymd));
2413 template<
typename _CharT,
typename _Traits>
2414 inline basic_ostream<_CharT, _Traits>&
2415 operator<<(basic_ostream<_CharT, _Traits>& __os,
2416 const year_month_day_last& __ymdl)
2419 basic_stringstream<_CharT> __os2;
2420 __os2.imbue(__os.getloc());
2421 __os2 << __ymdl.year();
2422 if constexpr (is_same_v<_CharT, char>)
2426 __os2 << __ymdl.month_day_last();
2427 __os << __os2.view();
2431 template<
typename _CharT,
typename _Traits>
2432 inline basic_ostream<_CharT, _Traits>&
2433 operator<<(basic_ostream<_CharT, _Traits>& __os,
2434 const year_month_weekday& __ymwd)
2438 basic_stringstream<_CharT> __os2;
2439 __os2.imbue(__os.getloc());
2441 if constexpr (is_same_v<_CharT, char>)
2445 __os2 << __ymwd.year() << __slash << __ymwd.month() << __slash
2446 << __ymwd.weekday_indexed();
2447 __os << __os2.view();
2451 template<
typename _CharT,
typename _Traits>
2452 inline basic_ostream<_CharT, _Traits>&
2453 operator<<(basic_ostream<_CharT, _Traits>& __os,
2454 const year_month_weekday_last& __ymwdl)
2458 basic_stringstream<_CharT> __os2;
2459 __os2.imbue(__os.getloc());
2461 if constexpr (is_same_v<_CharT, char>)
2465 __os2 << __ymwdl.year() << __slash << __ymwdl.month() << __slash
2466 << __ymwdl.weekday_last();
2467 __os << __os2.view();
2471 template<
typename _CharT,
typename _Traits,
typename _Duration>
2472 inline basic_ostream<_CharT, _Traits>&
2473 operator<<(basic_ostream<_CharT, _Traits>& __os,
2474 const hh_mm_ss<_Duration>& __hms)
2476 return __os << format(__os.getloc(), _GLIBCXX_WIDEN(
"{:L%T}"), __hms);
2479#if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
2481 template<
typename _CharT,
typename _Traits>
2482 basic_ostream<_CharT, _Traits>&
2483 operator<<(basic_ostream<_CharT, _Traits>& __os,
const sys_info& __i)
2485 __os <<
'[' << __i.begin <<
',' << __i.end
2486 <<
',' << hh_mm_ss(__i.offset) <<
',' << __i.save
2487 <<
',' << __i.abbrev <<
']';
2492 template<
typename _CharT,
typename _Traits>
2493 basic_ostream<_CharT, _Traits>&
2494 operator<<(basic_ostream<_CharT, _Traits>& __os,
const local_info& __li)
2497 if (__li.result == local_info::unique)
2501 if (__li.result == local_info::nonexistent)
2502 __os <<
"nonexistent";
2504 __os <<
"ambiguous";
2505 __os <<
" local time between " << __li.first;
2506 __os <<
" and " << __li.second;
2512 template<
typename _CharT,
typename _Traits,
typename _Duration,
2513 typename _TimeZonePtr>
2514 inline basic_ostream<_CharT, _Traits>&
2515 operator<<(basic_ostream<_CharT, _Traits>& __os,
2516 const zoned_time<_Duration, _TimeZonePtr>& __t)
2518 __os << format(__os.getloc(), _GLIBCXX_WIDEN(
"{:L%F %T %Z}"), __t);
2523 template<
typename _CharT,
typename _Traits,
typename _Duration>
2524 requires (!treat_as_floating_point_v<typename _Duration::rep>)
2525 && ratio_less_v<typename _Duration::period, days::period>
2526 inline basic_ostream<_CharT, _Traits>&
2527 operator<<(basic_ostream<_CharT, _Traits>& __os,
2528 const sys_time<_Duration>& __tp)
2530 __os << std::format(__os.getloc(), _GLIBCXX_WIDEN(
"{:L%F %T}"), __tp);
2534 template<
typename _CharT,
typename _Traits>
2535 inline basic_ostream<_CharT, _Traits>&
2536 operator<<(basic_ostream<_CharT, _Traits>& __os,
const sys_days& __dp)
2538 __os << year_month_day{__dp};
2544 template<
typename _CharT,
typename _Traits,
typename _Duration>
2545 inline basic_ostream<_CharT, _Traits>&
2546 operator<<(basic_ostream<_CharT, _Traits>& __os,
2547 const utc_time<_Duration>& __t)
2549 __os << std::format(__os.getloc(), _GLIBCXX_WIDEN(
"{:L%F %T}"), __t);
2555 template<
typename _CharT,
typename _Traits,
typename _Duration>
2556 inline basic_ostream<_CharT, _Traits>&
2557 operator<<(basic_ostream<_CharT, _Traits>& __os,
2558 const tai_time<_Duration>& __t)
2560 __os << std::format(__os.getloc(), _GLIBCXX_WIDEN(
"{:L%F %T}"), __t);
2566 template<
typename _CharT,
typename _Traits,
typename _Duration>
2567 inline basic_ostream<_CharT, _Traits>&
2568 operator<<(basic_ostream<_CharT, _Traits>& __os,
2569 const gps_time<_Duration>& __t)
2571 __os << std::format(__os.getloc(), _GLIBCXX_WIDEN(
"{:L%F %T}"), __t);
2578 template<
typename _CharT,
typename _Traits,
typename _Duration>
2579 inline basic_ostream<_CharT, _Traits>&
2580 operator<<(basic_ostream<_CharT, _Traits>& __os,
2581 const file_time<_Duration>& __t)
2583 __os << std::format(__os.getloc(), _GLIBCXX_WIDEN(
"{:L%F %T}"), __t);
2589 template<
typename _CharT,
typename _Traits,
typename _Duration>
2590 inline basic_ostream<_CharT, _Traits>&
2591 operator<<(basic_ostream<_CharT, _Traits>& __os,
2592 const local_time<_Duration>& __lt)
2594 __os << sys_time<_Duration>{__lt.time_since_epoch()};
2599#undef _GLIBCXX_WIDEN
2604_GLIBCXX_END_NAMESPACE_VERSION
__detail::__local_time_fmt< _Duration > local_time_format(local_time< _Duration > __time, const string *__abbrev=nullptr, const seconds *__offset_sec=nullptr)
duration< int64_t, ratio< 86400 > > days
days
basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const duration< _Rep, _Period > &__d)
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
ISO C++ entities toplevel namespace is std.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
constexpr bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
Implementation details not part of the namespace std interface.
ISO C++ 2011 namespace for date and time utilities.
Template class basic_ostream.
Controlling output for std::string.
Properties of fundamental types.
Provides compile-time rational arithmetic.
chrono::duration represents a distance between two points in time
chrono::time_point represents a point in time as measured by a clock
streamsize precision() const
Flags access.
fmtflags flags() const
Access to format flags.
locale getloc() const
Locale access.
Container class for localization functionality.
static const locale & classic()
Return reference to the C locale.