30#ifndef _GLIBCXX_CHRONO
31#define _GLIBCXX_CHRONO 1
33#pragma GCC system_header
35#if __cplusplus < 201103L
40#if __cplusplus > 201703L
45namespace std _GLIBCXX_VISIBILITY(default)
47_GLIBCXX_BEGIN_NAMESPACE_VERSION
64#if __cplusplus >= 202002L
68 template<
typename _Duration>
70 using local_seconds = local_time<seconds>;
71 using local_days = local_time<days>;
77 template<
typename _Duration>
79 using utc_seconds = utc_time<seconds>;
81 template<
typename _Duration>
83 using tai_seconds = tai_time<seconds>;
85 template<
typename _Duration>
87 using gps_seconds = gps_time<seconds>;
89 template<>
struct is_clock<utc_clock> :
true_type { };
90 template<>
struct is_clock<tai_clock> :
true_type { };
91 template<>
struct is_clock<gps_clock> :
true_type { };
93 template<>
inline constexpr bool is_clock_v<utc_clock> =
true;
94 template<>
inline constexpr bool is_clock_v<tai_clock> =
true;
95 template<>
inline constexpr bool is_clock_v<gps_clock> =
true;
97 struct leap_second_info
110 class weekday_indexed;
113 class month_day_last;
115 class month_weekday_last;
117 class year_month_day;
118 class year_month_day_last;
119 class year_month_weekday;
120 class year_month_weekday_last;
124 explicit last_spec() =
default;
126 friend constexpr month_day_last
129 friend constexpr month_day_last
133 inline constexpr last_spec last{};
138 template <
unsigned __d,
typename _Tp>
143 auto constexpr __a = _Up(-1) - _Up(255 + __d - 2);
144 auto constexpr __b = _Up(__d * (__a / __d) - 1);
146 return _Up(-1) - __b;
152 template <
unsigned __d,
typename _Tp>
154 __add_modulo(
unsigned __x, _Tp __y)
166 auto const __offset = __y >= 0 ? _Up(0) : __modulo_offset<__d, _Tp>();
167 return (__x + _Up(__y) - __offset) % __d;
171 template <
unsigned __d,
typename _Tp>
173 __sub_modulo(
unsigned __x, _Tp __y)
176 auto const __offset = __y <= 0 ? _Up(0) : __modulo_offset<__d, _Tp>();
177 return (__x - _Up(__y) - __offset) % __d;
180 inline constexpr unsigned __days_per_month[12]
181 = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
195 day(
unsigned __d) noexcept
200 operator++()
noexcept
207 operator++(
int)
noexcept
215 operator--()
noexcept
222 operator--(
int)
noexcept
230 operator+=(
const days& __d)
noexcept
237 operator-=(
const days& __d)
noexcept
244 operator unsigned()
const noexcept
249 {
return 1 <= _M_d && _M_d <= 31; }
251 friend constexpr bool
252 operator==(
const day& __x,
const day& __y)
noexcept
253 {
return unsigned{__x} ==
unsigned{__y}; }
255 friend constexpr strong_ordering
256 operator<=>(
const day& __x,
const day& __y)
noexcept
257 {
return unsigned{__x} <=>
unsigned{__y}; }
261 {
return day(
unsigned{__x} + __y.count()); }
265 {
return __y + __x; }
269 {
return __x + -__y; }
271 friend constexpr days
272 operator-(
const day& __x,
const day& __y)
noexcept
273 {
return days{int(
unsigned{__x}) -
int(
unsigned{__y})}; }
275 friend constexpr month_day
276 operator/(
const month& __m,
const day& __d)
noexcept;
278 friend constexpr month_day
279 operator/(
int __m,
const day& __d)
noexcept;
281 friend constexpr month_day
282 operator/(
const day& __d,
const month& __m)
noexcept;
284 friend constexpr month_day
285 operator/(
const day& __d,
int __m)
noexcept;
287 friend constexpr year_month_day
288 operator/(
const year_month& __ym,
const day& __d)
noexcept;
304 month(
unsigned __m) noexcept
309 operator++()
noexcept
316 operator++(
int)
noexcept
324 operator--()
noexcept
331 operator--(
int)
noexcept
339 operator+=(
const months& __m)
noexcept
346 operator-=(
const months& __m)
noexcept
353 operator unsigned()
const noexcept
358 {
return 1 <= _M_m && _M_m <= 12; }
360 friend constexpr bool
361 operator==(
const month& __x,
const month& __y)
noexcept
362 {
return unsigned{__x} ==
unsigned{__y}; }
364 friend constexpr strong_ordering
365 operator<=>(
const month& __x,
const month& __y)
noexcept
366 {
return unsigned{__x} <=>
unsigned{__y}; }
368 friend constexpr month
373 return month{1 + __detail::__add_modulo<12>(
374 unsigned{__x} + 11, __y.count())};
377 friend constexpr month
379 {
return __y + __x; }
381 friend constexpr month
386 return month{1 + __detail::__sub_modulo<12>(
387 unsigned{__x} + 11, __y.count())};
391 operator-(
const month& __x,
const month& __y)
noexcept
393 const auto __dm = int(
unsigned(__x)) - int(
unsigned(__y));
394 return months{__dm < 0 ? 12 + __dm : __dm};
397 friend constexpr year_month
398 operator/(
const year& __y,
const month& __m)
noexcept;
400 friend constexpr month_day
401 operator/(
const month& __m,
int __d)
noexcept;
403 friend constexpr month_day_last
404 operator/(
const month& __m, last_spec)
noexcept;
406 friend constexpr month_day_last
407 operator/(last_spec,
const month& __m)
noexcept;
409 friend constexpr month_weekday
410 operator/(
const month& __m,
const weekday_indexed& __wdi)
noexcept;
412 friend constexpr month_weekday
413 operator/(
const weekday_indexed& __wdi,
const month& __m)
noexcept;
415 friend constexpr month_weekday_last
416 operator/(
const month& __m,
const weekday_last& __wdl)
noexcept;
418 friend constexpr month_weekday_last
419 operator/(
const weekday_last& __wdl,
const month& __m)
noexcept;
424 inline constexpr month January{1};
425 inline constexpr month February{2};
426 inline constexpr month March{3};
427 inline constexpr month April{4};
428 inline constexpr month May{5};
429 inline constexpr month June{6};
430 inline constexpr month July{7};
431 inline constexpr month August{8};
432 inline constexpr month September{9};
433 inline constexpr month October{10};
434 inline constexpr month November{11};
435 inline constexpr month December{12};
448 year(
int __y) noexcept
449 : _M_y{
static_cast<short>(__y)}
452 static constexpr year
454 {
return year{-32767}; }
456 static constexpr year
458 {
return year{32767}; }
461 operator++()
noexcept
468 operator++(
int)
noexcept
476 operator--()
noexcept
483 operator--(
int)
noexcept
491 operator+=(
const years& __y)
noexcept
498 operator-=(
const years& __y)
noexcept
510 {
return year{-_M_y}; }
513 is_leap()
const noexcept
537 return (_M_y & (_M_y % 25 == 0 ? 15 : 3)) == 0;
541 operator int()
const noexcept
546 {
return min()._M_y <= _M_y && _M_y <= max()._M_y; }
548 friend constexpr bool
549 operator==(
const year& __x,
const year& __y)
noexcept
550 {
return int{__x} ==
int{__y}; }
552 friend constexpr strong_ordering
553 operator<=>(
const year& __x,
const year& __y)
noexcept
554 {
return int{__x} <=>
int{__y}; }
556 friend constexpr year
558 {
return year{
int{__x} +
static_cast<int>(__y.count())}; }
560 friend constexpr year
562 {
return __y + __x; }
564 friend constexpr year
566 {
return __x + -__y; }
568 friend constexpr years
569 operator-(
const year& __x,
const year& __y)
noexcept
570 {
return years{
int{__x} -
int{__y}}; }
572 friend constexpr year_month
573 operator/(
const year& __y,
int __m)
noexcept;
575 friend constexpr year_month_day
576 operator/(
const year& __y,
const month_day& __md)
noexcept;
578 friend constexpr year_month_day
579 operator/(
const month_day& __md,
const year& __y)
noexcept;
581 friend constexpr year_month_day_last
582 operator/(
const year& __y,
const month_day_last& __mdl)
noexcept;
584 friend constexpr year_month_day_last
585 operator/(
const month_day_last& __mdl,
const year& __y)
noexcept;
587 friend constexpr year_month_weekday
588 operator/(
const year& __y,
const month_weekday& __mwd)
noexcept;
590 friend constexpr year_month_weekday
591 operator/(
const month_weekday& __mwd,
const year& __y)
noexcept;
593 friend constexpr year_month_weekday_last
594 operator/(
const year& __y,
const month_weekday_last& __mwdl)
noexcept;
596 friend constexpr year_month_weekday_last
597 operator/(
const month_weekday_last& __mwdl,
const year& __y)
noexcept;
609 static constexpr weekday
610 _S_from_days(
const days& __d)
612 return weekday{__detail::__add_modulo<7>(4, __d.count())};
619 weekday(
unsigned __wd) noexcept
620 : _M_wd(__wd == 7 ? 0 : __wd)
624 weekday(
const sys_days& __dp) noexcept
625 : weekday{_S_from_days(__dp.time_since_epoch())}
629 weekday(
const local_days& __dp) noexcept
630 : weekday{sys_days{__dp.time_since_epoch()}}
634 operator++()
noexcept
641 operator++(
int)
noexcept
649 operator--()
noexcept
656 operator--(
int)
noexcept
664 operator+=(
const days& __d)
noexcept
671 operator-=(
const days& __d)
noexcept
678 c_encoding()
const noexcept
682 iso_encoding()
const noexcept
683 {
return _M_wd == 0u ? 7u : _M_wd; }
687 {
return _M_wd <= 6; }
689 constexpr weekday_indexed
690 operator[](
unsigned __index)
const noexcept;
692 constexpr weekday_last
693 operator[](last_spec)
const noexcept;
695 friend constexpr bool
696 operator==(
const weekday& __x,
const weekday& __y)
noexcept
697 {
return __x._M_wd == __y._M_wd; }
699 friend constexpr weekday
702 return weekday{__detail::__add_modulo<7>(__x._M_wd, __y.count())};
705 friend constexpr weekday
707 {
return __y + __x; }
709 friend constexpr weekday
712 return weekday{__detail::__sub_modulo<7>(__x._M_wd, __y.count())};
715 friend constexpr days
716 operator-(
const weekday& __x,
const weekday& __y)
noexcept
718 const auto __n = __x.c_encoding() - __y.c_encoding();
719 return static_cast<int>(__n) >= 0 ?
days{__n} :
days{__n + 7};
725 inline constexpr weekday Sunday{0};
726 inline constexpr weekday Monday{1};
727 inline constexpr weekday Tuesday{2};
728 inline constexpr weekday Wednesday{3};
729 inline constexpr weekday Thursday{4};
730 inline constexpr weekday Friday{5};
731 inline constexpr weekday Saturday{6};
735 class weekday_indexed
738 chrono::weekday _M_wd;
739 unsigned char _M_index;
742 weekday_indexed() =
default;
745 weekday_indexed(
const chrono::weekday& __wd,
unsigned __index) noexcept
746 : _M_wd(__wd), _M_index(__index)
749 constexpr chrono::weekday
750 weekday()
const noexcept
754 index()
const noexcept
755 {
return _M_index; };
759 {
return _M_wd.ok() && 1 <= _M_index && _M_index <= 5; }
761 friend constexpr bool
762 operator==(
const weekday_indexed& __x,
const weekday_indexed& __y)
noexcept
763 {
return __x.weekday() == __y.weekday() && __x.index() == __y.index(); }
765 friend constexpr month_weekday
766 operator/(
const month& __m,
const weekday_indexed& __wdi)
noexcept;
768 friend constexpr month_weekday
769 operator/(
int __m,
const weekday_indexed& __wdi)
noexcept;
771 friend constexpr month_weekday
772 operator/(
const weekday_indexed& __wdi,
const month& __m)
noexcept;
774 friend constexpr month_weekday
775 operator/(
const weekday_indexed& __wdi,
int __m)
noexcept;
777 friend constexpr year_month_weekday
778 operator/(
const year_month& __ym,
const weekday_indexed& __wdi)
noexcept;
783 constexpr weekday_indexed
784 weekday::operator[](
unsigned __index)
const noexcept
785 {
return {*
this, __index}; }
792 chrono::weekday _M_wd;
796 weekday_last(
const chrono::weekday& __wd) noexcept
800 constexpr chrono::weekday
801 weekday()
const noexcept
806 {
return _M_wd.ok(); }
808 friend constexpr bool
809 operator==(
const weekday_last& __x,
const weekday_last& __y)
noexcept
810 {
return __x.weekday() == __y.weekday(); }
812 friend constexpr month_weekday_last
813 operator/(
int __m,
const weekday_last& __wdl)
noexcept;
815 friend constexpr month_weekday_last
816 operator/(
const weekday_last& __wdl,
int __m)
noexcept;
818 friend constexpr year_month_weekday_last
819 operator/(
const year_month& __ym,
const weekday_last& __wdl)
noexcept;
824 constexpr weekday_last
825 weekday::operator[](last_spec)
const noexcept
826 {
return weekday_last{*
this}; }
837 month_day() =
default;
840 month_day(
const chrono::month& __m,
const chrono::day& __d) noexcept
841 : _M_m{__m}, _M_d{__d}
844 constexpr chrono::month
845 month()
const noexcept
848 constexpr chrono::day
856 && 1u <= unsigned(_M_d)
857 && unsigned(_M_d) <= __detail::__days_per_month[unsigned(_M_m) - 1];
860 friend constexpr bool
861 operator==(
const month_day& __x,
const month_day& __y)
noexcept
862 {
return __x.month() == __y.month() && __x.day() == __y.day(); }
864 friend constexpr strong_ordering
865 operator<=>(
const month_day& __x,
const month_day& __y)
noexcept
868 friend constexpr month_day
869 operator/(
const chrono::month& __m,
const chrono::day& __d)
noexcept
870 {
return {__m, __d}; }
872 friend constexpr month_day
873 operator/(
const chrono::month& __m,
int __d)
noexcept
874 {
return {__m, chrono::day(
unsigned(__d))}; }
876 friend constexpr month_day
877 operator/(
int __m,
const chrono::day& __d)
noexcept
878 {
return {chrono::month(
unsigned(__m)), __d}; }
880 friend constexpr month_day
881 operator/(
const chrono::day& __d,
const chrono::month& __m)
noexcept
882 {
return {__m, __d}; }
884 friend constexpr month_day
885 operator/(
const chrono::day& __d,
int __m)
noexcept
886 {
return {chrono::month(
unsigned(__m)), __d}; }
888 friend constexpr year_month_day
889 operator/(
int __y,
const month_day& __md)
noexcept;
891 friend constexpr year_month_day
892 operator/(
const month_day& __md,
int __y)
noexcept;
906 month_day_last(
const chrono::month& __m) noexcept
910 constexpr chrono::month
911 month()
const noexcept
916 {
return _M_m.ok(); }
918 friend constexpr bool
919 operator==(
const month_day_last& __x,
const month_day_last& __y)
noexcept
920 {
return __x.month() == __y.month(); }
922 friend constexpr strong_ordering
923 operator<=>(
const month_day_last& __x,
const month_day_last& __y)
noexcept
926 friend constexpr month_day_last
927 operator/(
const chrono::month& __m, last_spec)
noexcept
928 {
return month_day_last{__m}; }
930 friend constexpr month_day_last
932 {
return chrono::month(
unsigned(__m)) / last; }
934 friend constexpr month_day_last
935 operator/(last_spec,
const chrono::month& __m)
noexcept
936 {
return __m / last; }
938 friend constexpr month_day_last
940 {
return __m / last; }
942 friend constexpr year_month_day_last
943 operator/(
int __y,
const month_day_last& __mdl)
noexcept;
945 friend constexpr year_month_day_last
946 operator/(
const month_day_last& __mdl,
int __y)
noexcept;
957 chrono::weekday_indexed _M_wdi;
961 month_weekday(
const chrono::month& __m,
962 const chrono::weekday_indexed& __wdi) noexcept
963 : _M_m{__m}, _M_wdi{__wdi}
966 constexpr chrono::month
967 month()
const noexcept
970 constexpr chrono::weekday_indexed
971 weekday_indexed()
const noexcept
976 {
return _M_m.ok() && _M_wdi.ok(); }
978 friend constexpr bool
979 operator==(
const month_weekday& __x,
const month_weekday& __y)
noexcept
981 return __x.month() == __y.month()
982 && __x.weekday_indexed() == __y.weekday_indexed();
985 friend constexpr month_weekday
987 const chrono::weekday_indexed& __wdi)
noexcept
988 {
return {__m, __wdi}; }
990 friend constexpr month_weekday
991 operator/(
int __m,
const chrono::weekday_indexed& __wdi)
noexcept
992 {
return chrono::month(
unsigned(__m)) / __wdi; }
994 friend constexpr month_weekday
995 operator/(
const chrono::weekday_indexed& __wdi,
996 const chrono::month& __m)
noexcept
997 {
return __m / __wdi; }
999 friend constexpr month_weekday
1000 operator/(
const chrono::weekday_indexed& __wdi,
int __m)
noexcept
1001 {
return __m / __wdi; }
1003 friend constexpr year_month_weekday
1004 operator/(
int __y,
const month_weekday& __mwd)
noexcept;
1006 friend constexpr year_month_weekday
1007 operator/(
const month_weekday& __mwd,
int __y)
noexcept;
1014 class month_weekday_last
1018 chrono::weekday_last _M_wdl;
1022 month_weekday_last(
const chrono::month& __m,
1023 const chrono::weekday_last& __wdl) noexcept
1024 :_M_m{__m}, _M_wdl{__wdl}
1027 constexpr chrono::month
1028 month()
const noexcept
1031 constexpr chrono::weekday_last
1032 weekday_last()
const noexcept
1037 {
return _M_m.ok() && _M_wdl.ok(); }
1039 friend constexpr bool
1040 operator==(
const month_weekday_last& __x,
1041 const month_weekday_last& __y)
noexcept
1043 return __x.month() == __y.month()
1044 && __x.weekday_last() == __y.weekday_last();
1047 friend constexpr month_weekday_last
1049 const chrono::weekday_last& __wdl)
noexcept
1050 {
return {__m, __wdl}; }
1052 friend constexpr month_weekday_last
1053 operator/(
int __m,
const chrono::weekday_last& __wdl)
noexcept
1054 {
return chrono::month(
unsigned(__m)) / __wdl; }
1056 friend constexpr month_weekday_last
1057 operator/(
const chrono::weekday_last& __wdl,
1058 const chrono::month& __m)
noexcept
1059 {
return __m / __wdl; }
1061 friend constexpr month_weekday_last
1062 operator/(
const chrono::weekday_last& __wdl,
int __m)
noexcept
1063 {
return chrono::month(
unsigned(__m)) / __wdl; }
1065 friend constexpr year_month_weekday_last
1066 operator/(
int __y,
const month_weekday_last& __mwdl)
noexcept;
1068 friend constexpr year_month_weekday_last
1069 operator/(
const month_weekday_last& __mwdl,
int __y)
noexcept;
1090 using __months_years_conversion_disambiguator = void;
1100 year_month() =
default;
1103 year_month(
const chrono::year& __y,
const chrono::month& __m) noexcept
1104 : _M_y{__y}, _M_m{__m}
1107 constexpr chrono::year
1108 year()
const noexcept
1111 constexpr chrono::month
1112 month()
const noexcept
1115 template<
typename = __detail::__months_years_conversion_disambiguator>
1116 constexpr year_month&
1117 operator+=(
const months& __dm)
noexcept
1119 *
this = *
this + __dm;
1123 template<
typename = __detail::__months_years_conversion_disambiguator>
1124 constexpr year_month&
1125 operator-=(
const months& __dm)
noexcept
1127 *
this = *
this - __dm;
1131 constexpr year_month&
1132 operator+=(
const years& __dy)
noexcept
1134 *
this = *
this + __dy;
1138 constexpr year_month&
1139 operator-=(
const years& __dy)
noexcept
1141 *
this = *
this - __dy;
1147 {
return _M_y.ok() && _M_m.ok(); }
1149 friend constexpr bool
1150 operator==(
const year_month& __x,
const year_month& __y)
noexcept
1151 {
return __x.year() == __y.year() && __x.month() == __y.month(); }
1153 friend constexpr strong_ordering
1154 operator<=>(
const year_month& __x,
const year_month& __y)
noexcept
1157 template<
typename = __detail::__months_years_conversion_disambiguator>
1158 friend constexpr year_month
1162 auto __m = __ym.month() + __dm;
1163 auto __i = int(
unsigned(__ym.month())) - 1 + __dm.count();
1165 ? __ym.year() +
years{(__i - 11) / 12}
1166 : __ym.year() +
years{__i / 12});
1170 template<
typename = __detail::__months_years_conversion_disambiguator>
1171 friend constexpr year_month
1173 {
return __ym + __dm; }
1175 template<
typename = __detail::__months_years_conversion_disambiguator>
1176 friend constexpr year_month
1178 {
return __ym + -__dm; }
1181 operator-(
const year_month& __x,
const year_month& __y)
noexcept
1183 return (__x.year() - __y.year()
1184 +
months{static_cast<int>(unsigned{__x.month()})
1185 -
static_cast<int>(
unsigned{__y.month()})});
1188 friend constexpr year_month
1190 {
return (__ym.year() + __dy) / __ym.month(); }
1192 friend constexpr year_month
1194 {
return __ym + __dy; }
1196 friend constexpr year_month
1198 {
return __ym + -__dy; }
1200 friend constexpr year_month
1201 operator/(
const chrono::year& __y,
const chrono::month& __m)
noexcept
1202 {
return {__y, __m}; }
1204 friend constexpr year_month
1205 operator/(
const chrono::year& __y,
int __m)
noexcept
1206 {
return {__y, chrono::month(
unsigned(__m))}; }
1208 friend constexpr year_month_day
1209 operator/(
const year_month& __ym,
int __d)
noexcept;
1211 friend constexpr year_month_day_last
1212 operator/(
const year_month& __ym, last_spec)
noexcept;
1219 class year_month_day
1226 static constexpr year_month_day _S_from_days(
const days& __dp)
noexcept;
1228 constexpr days _M_days_since_epoch() const noexcept;
1231 year_month_day() = default;
1234 year_month_day(const chrono::year& __y, const chrono::month& __m,
1235 const chrono::day& __d) noexcept
1236 : _M_y{__y}, _M_m{__m}, _M_d{__d}
1240 year_month_day(
const year_month_day_last& __ymdl)
noexcept;
1243 year_month_day(
const sys_days& __dp) noexcept
1244 : year_month_day(_S_from_days(__dp.time_since_epoch()))
1248 year_month_day(
const local_days& __dp) noexcept
1249 : year_month_day(sys_days{__dp.time_since_epoch()})
1252 template<
typename = __detail::__months_years_conversion_disambiguator>
1253 constexpr year_month_day&
1254 operator+=(
const months& __m)
noexcept
1256 *
this = *
this + __m;
1260 template<
typename = __detail::__months_years_conversion_disambiguator>
1261 constexpr year_month_day&
1262 operator-=(
const months& __m)
noexcept
1264 *
this = *
this - __m;
1268 constexpr year_month_day&
1269 operator+=(
const years& __y)
noexcept
1271 *
this = *
this + __y;
1275 constexpr year_month_day&
1276 operator-=(
const years& __y)
noexcept
1278 *
this = *
this - __y;
1282 constexpr chrono::year
1283 year() const noexcept
1286 constexpr chrono::month
1287 month() const noexcept
1290 constexpr chrono::day
1291 day() const noexcept
1295 operator sys_days() const noexcept
1296 {
return sys_days{_M_days_since_epoch()}; }
1299 operator local_days() const noexcept
1300 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
1302 constexpr bool ok() const noexcept;
1304 friend constexpr
bool
1305 operator==(const year_month_day& __x, const year_month_day& __y) noexcept
1307 return __x.year() == __y.year()
1308 && __x.month() == __y.month()
1309 && __x.day() == __y.day();
1312 friend constexpr strong_ordering
1313 operator<=>(
const year_month_day& __x,
const year_month_day& __y)
noexcept
1316 template<
typename = __detail::__months_years_conversion_disambiguator>
1317 friend constexpr year_month_day
1318 operator+(
const year_month_day& __ymd,
const months& __dm)
noexcept
1319 {
return (__ymd.year() / __ymd.month() + __dm) / __ymd.day(); }
1321 template<
typename = __detail::__months_years_conversion_disambiguator>
1322 friend constexpr year_month_day
1323 operator+(
const months& __dm,
const year_month_day& __ymd)
noexcept
1324 {
return __ymd + __dm; }
1326 friend constexpr year_month_day
1327 operator+(
const year_month_day& __ymd,
const years& __dy)
noexcept
1328 {
return (__ymd.year() + __dy) / __ymd.month() / __ymd.day(); }
1330 friend constexpr year_month_day
1331 operator+(
const years& __dy,
const year_month_day& __ymd)
noexcept
1332 {
return __ymd + __dy; }
1334 template<
typename = __detail::__months_years_conversion_disambiguator>
1335 friend constexpr year_month_day
1336 operator-(
const year_month_day& __ymd,
const months& __dm)
noexcept
1337 {
return __ymd + -__dm; }
1339 friend constexpr year_month_day
1340 operator-(
const year_month_day& __ymd,
const years& __dy)
noexcept
1341 {
return __ymd + -__dy; }
1343 friend constexpr year_month_day
1344 operator/(
const year_month& __ym,
const chrono::day& __d)
noexcept
1345 {
return {__ym.year(), __ym.month(), __d}; }
1347 friend constexpr year_month_day
1348 operator/(
const year_month& __ym,
int __d)
noexcept
1349 {
return __ym / chrono::day{unsigned(__d)}; }
1351 friend constexpr year_month_day
1352 operator/(
const chrono::year& __y,
const month_day& __md)
noexcept
1353 {
return __y / __md.month() / __md.day(); }
1355 friend constexpr year_month_day
1356 operator/(
int __y,
const month_day& __md)
noexcept
1357 {
return chrono::year{__y} / __md; }
1359 friend constexpr year_month_day
1360 operator/(
const month_day& __md,
const chrono::year& __y)
noexcept
1361 {
return __y / __md; }
1363 friend constexpr year_month_day
1364 operator/(
const month_day& __md,
int __y)
noexcept
1365 {
return chrono::year(__y) / __md; }
1374 constexpr year_month_day
1375 year_month_day::_S_from_days(
const days& __dp)
noexcept
1377 constexpr auto __z2 =
static_cast<uint32_t
>(-1468000);
1378 constexpr auto __r2_e3 =
static_cast<uint32_t
>(536895458);
1380 const auto __r0 =
static_cast<uint32_t
>(__dp.count()) + __r2_e3;
1382 const auto __n1 = 4 * __r0 + 3;
1383 const auto __q1 = __n1 / 146097;
1384 const auto __r1 = __n1 % 146097 / 4;
1386 constexpr auto __p32 =
static_cast<uint64_t
>(1) << 32;
1387 const auto __n2 = 4 * __r1 + 3;
1388 const auto __u2 =
static_cast<uint64_t
>(2939745) * __n2;
1389 const auto __q2 =
static_cast<uint32_t
>(__u2 / __p32);
1390 const auto __r2 =
static_cast<uint32_t
>(__u2 % __p32) / 2939745 / 4;
1392 constexpr auto __p16 =
static_cast<uint32_t
>(1) << 16;
1393 const auto __n3 = 2141 * __r2 + 197913;
1394 const auto __q3 = __n3 / __p16;
1395 const auto __r3 = __n3 % __p16 / 2141;
1397 const auto __y0 = 100 * __q1 + __q2;
1398 const auto __m0 = __q3;
1399 const auto __d0 = __r3;
1401 const auto __j = __r2 >= 306;
1402 const auto __y1 = __y0 + __j;
1403 const auto __m1 = __j ? __m0 - 12 : __m0;
1404 const auto __d1 = __d0 + 1;
1406 return year_month_day{chrono::year{
static_cast<int>(__y1 + __z2)},
1407 chrono::month{__m1}, chrono::day{__d1}};
1415 year_month_day::_M_days_since_epoch() const noexcept
1417 auto constexpr __z2 =
static_cast<uint32_t
>(-1468000);
1418 auto constexpr __r2_e3 =
static_cast<uint32_t
>(536895458);
1420 const auto __y1 =
static_cast<uint32_t
>(
static_cast<int>(_M_y)) - __z2;
1421 const auto __m1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_m));
1422 const auto __d1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_d));
1424 const auto __j =
static_cast<uint32_t
>(__m1 < 3);
1425 const auto __y0 = __y1 - __j;
1426 const auto __m0 = __j ? __m1 + 12 : __m1;
1427 const auto __d0 = __d1 - 1;
1429 const auto __q1 = __y0 / 100;
1430 const auto __yc = 1461 * __y0 / 4 - __q1 + __q1 / 4;
1431 const auto __mc = (979 *__m0 - 2919) / 32;
1432 const auto __dc = __d0;
1434 return days{
static_cast<int32_t
>(__yc + __mc + __dc - __r2_e3)};
1439 class year_month_day_last
1443 chrono::month_day_last _M_mdl;
1447 year_month_day_last(
const chrono::year& __y,
1448 const chrono::month_day_last& __mdl) noexcept
1449 : _M_y{__y}, _M_mdl{__mdl}
1452 template<
typename = __detail::__months_years_conversion_disambiguator>
1453 constexpr year_month_day_last&
1454 operator+=(
const months& __m)
noexcept
1456 *
this = *
this + __m;
1460 template<
typename = __detail::__months_years_conversion_disambiguator>
1461 constexpr year_month_day_last&
1462 operator-=(
const months& __m)
noexcept
1464 *
this = *
this - __m;
1468 constexpr year_month_day_last&
1469 operator+=(
const years& __y)
noexcept
1471 *
this = *
this + __y;
1475 constexpr year_month_day_last&
1476 operator-=(
const years& __y)
noexcept
1478 *
this = *
this - __y;
1482 constexpr chrono::year
1483 year() const noexcept
1486 constexpr chrono::month
1487 month() const noexcept
1488 {
return _M_mdl.month(); }
1490 constexpr chrono::month_day_last
1491 month_day_last() const noexcept
1495 constexpr chrono::day
1496 day() const noexcept
1498 const auto __m =
static_cast<unsigned>(month());
1518 return chrono::day{__m != 2 ? (__m ^ (__m >> 3)) | 30
1519 : _M_y.is_leap() ? 29 : 28};
1523 operator sys_days() const noexcept
1524 {
return sys_days{year() / month() / day()}; }
1527 operator local_days() const noexcept
1528 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
1532 {
return _M_y.ok() && _M_mdl.ok(); }
1534 friend constexpr bool
1535 operator==(
const year_month_day_last& __x,
1536 const year_month_day_last& __y)
noexcept
1538 return __x.year() == __y.year()
1539 && __x.month_day_last() == __y.month_day_last();
1542 friend constexpr strong_ordering
1543 operator<=>(
const year_month_day_last& __x,
1544 const year_month_day_last& __y)
noexcept
1547 template<
typename = __detail::__months_years_conversion_disambiguator>
1548 friend constexpr year_month_day_last
1549 operator+(
const year_month_day_last& __ymdl,
1550 const months& __dm)
noexcept
1551 {
return (__ymdl.year() / __ymdl.month() + __dm) / last; }
1553 template<
typename = __detail::__months_years_conversion_disambiguator>
1554 friend constexpr year_month_day_last
1556 const year_month_day_last& __ymdl)
noexcept
1557 {
return __ymdl + __dm; }
1559 template<
typename = __detail::__months_years_conversion_disambiguator>
1560 friend constexpr year_month_day_last
1561 operator-(
const year_month_day_last& __ymdl,
1562 const months& __dm)
noexcept
1563 {
return __ymdl + -__dm; }
1565 friend constexpr year_month_day_last
1566 operator+(
const year_month_day_last& __ymdl,
1567 const years& __dy)
noexcept
1568 {
return {__ymdl.year() + __dy, __ymdl.month_day_last()}; }
1570 friend constexpr year_month_day_last
1572 const year_month_day_last& __ymdl)
noexcept
1573 {
return __ymdl + __dy; }
1575 friend constexpr year_month_day_last
1576 operator-(
const year_month_day_last& __ymdl,
1577 const years& __dy)
noexcept
1578 {
return __ymdl + -__dy; }
1580 friend constexpr year_month_day_last
1581 operator/(
const year_month& __ym, last_spec)
noexcept
1582 {
return {__ym.year(), chrono::month_day_last{__ym.month()}}; }
1584 friend constexpr year_month_day_last
1586 const chrono::month_day_last& __mdl)
noexcept
1587 {
return {__y, __mdl}; }
1589 friend constexpr year_month_day_last
1590 operator/(
int __y,
const chrono::month_day_last& __mdl)
noexcept
1591 {
return chrono::year(__y) / __mdl; }
1593 friend constexpr year_month_day_last
1594 operator/(
const chrono::month_day_last& __mdl,
1595 const chrono::year& __y)
noexcept
1596 {
return __y / __mdl; }
1598 friend constexpr year_month_day_last
1599 operator/(
const chrono::month_day_last& __mdl,
int __y)
noexcept
1600 {
return chrono::year(__y) / __mdl; }
1607 year_month_day::year_month_day(
const year_month_day_last& __ymdl) noexcept
1608 : _M_y{__ymdl.year()}, _M_m{__ymdl.month()}, _M_d{__ymdl.day()}
1612 year_month_day::ok() const noexcept
1614 if (!_M_y.ok() || !_M_m.ok())
1616 return chrono::day{1} <= _M_d && _M_d <= (_M_y / _M_m / last).day();
1621 class year_month_weekday
1626 chrono::weekday_indexed _M_wdi;
1628 static constexpr year_month_weekday
1629 _S_from_sys_days(
const sys_days& __dp)
1631 year_month_day __ymd{__dp};
1632 chrono::weekday __wd{__dp};
1633 auto __index = __wd[(
unsigned{__ymd.day()} - 1) / 7 + 1];
1634 return {__ymd.year(), __ymd.month(), __index};
1638 year_month_weekday() =
default;
1641 year_month_weekday(
const chrono::year& __y,
const chrono::month& __m,
1642 const chrono::weekday_indexed& __wdi) noexcept
1643 : _M_y{__y}, _M_m{__m}, _M_wdi{__wdi}
1647 year_month_weekday(
const sys_days& __dp) noexcept
1648 : year_month_weekday{_S_from_sys_days(__dp)}
1652 year_month_weekday(
const local_days& __dp) noexcept
1653 : year_month_weekday{sys_days{__dp.time_since_epoch()}}
1656 template<
typename = __detail::__months_years_conversion_disambiguator>
1657 constexpr year_month_weekday&
1658 operator+=(
const months& __m)
noexcept
1660 *
this = *
this + __m;
1664 template<
typename = __detail::__months_years_conversion_disambiguator>
1665 constexpr year_month_weekday&
1666 operator-=(
const months& __m)
noexcept
1668 *
this = *
this - __m;
1672 constexpr year_month_weekday&
1673 operator+=(
const years& __y)
noexcept
1675 *
this = *
this + __y;
1679 constexpr year_month_weekday&
1680 operator-=(
const years& __y)
noexcept
1682 *
this = *
this - __y;
1686 constexpr chrono::year
1687 year() const noexcept
1690 constexpr chrono::month
1691 month() const noexcept
1694 constexpr chrono::weekday
1695 weekday() const noexcept
1696 {
return _M_wdi.weekday(); }
1699 index() const noexcept
1700 {
return _M_wdi.index(); }
1702 constexpr chrono::weekday_indexed
1703 weekday_indexed() const noexcept
1707 operator sys_days() const noexcept
1709 auto __d = sys_days{year() / month() / 1};
1710 return __d + (weekday() - chrono::weekday(__d)
1711 +
days{(
static_cast<int>(index())-1)*7});
1715 operator local_days() const noexcept
1716 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
1721 if (!_M_y.ok() || !_M_m.ok() || !_M_wdi.ok())
1723 if (_M_wdi.index() <= 4)
1725 days __d = (_M_wdi.weekday()
1726 - chrono::weekday{sys_days{_M_y / _M_m / 1}}
1727 +
days((_M_wdi.index()-1)*7 + 1));
1728 __glibcxx_assert(__d.count() >= 1);
1729 return __d.count() <=
unsigned{(_M_y / _M_m / last).day()};
1732 friend constexpr bool
1733 operator==(
const year_month_weekday& __x,
1734 const year_month_weekday& __y)
noexcept
1736 return __x.year() == __y.year()
1737 && __x.month() == __y.month()
1738 && __x.weekday_indexed() == __y.weekday_indexed();
1741 template<
typename = __detail::__months_years_conversion_disambiguator>
1742 friend constexpr year_month_weekday
1743 operator+(
const year_month_weekday& __ymwd,
const months& __dm)
noexcept
1745 return ((__ymwd.year() / __ymwd.month() + __dm)
1746 / __ymwd.weekday_indexed());
1749 template<
typename = __detail::__months_years_conversion_disambiguator>
1750 friend constexpr year_month_weekday
1751 operator+(
const months& __dm,
const year_month_weekday& __ymwd)
noexcept
1752 {
return __ymwd + __dm; }
1754 friend constexpr year_month_weekday
1755 operator+(
const year_month_weekday& __ymwd,
const years& __dy)
noexcept
1756 {
return {__ymwd.year() + __dy, __ymwd.month(), __ymwd.weekday_indexed()}; }
1758 friend constexpr year_month_weekday
1759 operator+(
const years& __dy,
const year_month_weekday& __ymwd)
noexcept
1760 {
return __ymwd + __dy; }
1762 template<
typename = __detail::__months_years_conversion_disambiguator>
1763 friend constexpr year_month_weekday
1764 operator-(
const year_month_weekday& __ymwd,
const months& __dm)
noexcept
1765 {
return __ymwd + -__dm; }
1767 friend constexpr year_month_weekday
1768 operator-(
const year_month_weekday& __ymwd,
const years& __dy)
noexcept
1769 {
return __ymwd + -__dy; }
1771 friend constexpr year_month_weekday
1773 const chrono::weekday_indexed& __wdi)
noexcept
1774 {
return {__ym.year(), __ym.month(), __wdi}; }
1776 friend constexpr year_month_weekday
1777 operator/(
const chrono::year& __y,
const month_weekday& __mwd)
noexcept
1778 {
return {__y, __mwd.month(), __mwd.weekday_indexed()}; }
1780 friend constexpr year_month_weekday
1781 operator/(
int __y,
const month_weekday& __mwd)
noexcept
1782 {
return chrono::year(__y) / __mwd; }
1784 friend constexpr year_month_weekday
1785 operator/(
const month_weekday& __mwd,
const chrono::year& __y)
noexcept
1786 {
return __y / __mwd; }
1788 friend constexpr year_month_weekday
1789 operator/(
const month_weekday& __mwd,
int __y)
noexcept
1790 {
return chrono::year(__y) / __mwd; }
1797 class year_month_weekday_last
1802 chrono::weekday_last _M_wdl;
1806 year_month_weekday_last(
const chrono::year& __y,
const chrono::month& __m,
1807 const chrono::weekday_last& __wdl) noexcept
1808 : _M_y{__y}, _M_m{__m}, _M_wdl{__wdl}
1811 template<
typename = __detail::__months_years_conversion_disambiguator>
1812 constexpr year_month_weekday_last&
1813 operator+=(
const months& __m)
noexcept
1815 *
this = *
this + __m;
1819 template<
typename = __detail::__months_years_conversion_disambiguator>
1820 constexpr year_month_weekday_last&
1821 operator-=(
const months& __m)
noexcept
1823 *
this = *
this - __m;
1827 constexpr year_month_weekday_last&
1828 operator+=(
const years& __y)
noexcept
1830 *
this = *
this + __y;
1834 constexpr year_month_weekday_last&
1835 operator-=(
const years& __y)
noexcept
1837 *
this = *
this - __y;
1841 constexpr chrono::year
1842 year() const noexcept
1845 constexpr chrono::month
1846 month() const noexcept
1849 constexpr chrono::weekday
1850 weekday() const noexcept
1851 {
return _M_wdl.weekday(); }
1853 constexpr chrono::weekday_last
1854 weekday_last() const noexcept
1858 operator sys_days() const noexcept
1860 const auto __d = sys_days{_M_y / _M_m / last};
1861 return sys_days{(__d - (chrono::weekday{__d}
1862 - _M_wdl.weekday())).time_since_epoch()};
1866 operator local_days() const noexcept
1867 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
1871 {
return _M_y.ok() && _M_m.ok() && _M_wdl.ok(); }
1873 friend constexpr bool
1874 operator==(
const year_month_weekday_last& __x,
1875 const year_month_weekday_last& __y)
noexcept
1877 return __x.year() == __y.year()
1878 && __x.month() == __y.month()
1879 && __x.weekday_last() == __y.weekday_last();
1882 template<
typename = __detail::__months_years_conversion_disambiguator>
1883 friend constexpr year_month_weekday_last
1884 operator+(
const year_month_weekday_last& __ymwdl,
1885 const months& __dm)
noexcept
1887 return ((__ymwdl.year() / __ymwdl.month() + __dm)
1888 / __ymwdl.weekday_last());
1891 template<
typename = __detail::__months_years_conversion_disambiguator>
1892 friend constexpr year_month_weekday_last
1894 const year_month_weekday_last& __ymwdl)
noexcept
1895 {
return __ymwdl + __dm; }
1897 friend constexpr year_month_weekday_last
1898 operator+(
const year_month_weekday_last& __ymwdl,
1899 const years& __dy)
noexcept
1900 {
return {__ymwdl.year() + __dy, __ymwdl.month(), __ymwdl.weekday_last()}; }
1902 friend constexpr year_month_weekday_last
1904 const year_month_weekday_last& __ymwdl)
noexcept
1905 {
return __ymwdl + __dy; }
1907 template<
typename = __detail::__months_years_conversion_disambiguator>
1908 friend constexpr year_month_weekday_last
1909 operator-(
const year_month_weekday_last& __ymwdl,
1910 const months& __dm)
noexcept
1911 {
return __ymwdl + -__dm; }
1913 friend constexpr year_month_weekday_last
1914 operator-(
const year_month_weekday_last& __ymwdl,
1915 const years& __dy)
noexcept
1916 {
return __ymwdl + -__dy; }
1918 friend constexpr year_month_weekday_last
1920 const chrono::weekday_last& __wdl)
noexcept
1921 {
return {__ym.year(), __ym.month(), __wdl}; }
1923 friend constexpr year_month_weekday_last
1925 const chrono::month_weekday_last& __mwdl)
noexcept
1926 {
return {__y, __mwdl.month(), __mwdl.weekday_last()}; }
1928 friend constexpr year_month_weekday_last
1929 operator/(
int __y,
const chrono::month_weekday_last& __mwdl)
noexcept
1930 {
return chrono::year(__y) / __mwdl; }
1932 friend constexpr year_month_weekday_last
1933 operator/(
const chrono::month_weekday_last& __mwdl,
1934 const chrono::year& __y)
noexcept
1935 {
return __y / __mwdl; }
1937 friend constexpr year_month_weekday_last
1938 operator/(
const chrono::month_weekday_last& __mwdl,
int __y)
noexcept
1939 {
return chrono::year(__y) / __mwdl; }
1949 __pow10(
unsigned __n)
1958 template<
typename _Duration>
1962 static constexpr int
1963 _S_fractional_width()
1965 int __multiplicity_2 = 0;
1966 int __multiplicity_5 = 0;
1967 auto __den = _Duration::period::den;
1968 while ((__den % 2) == 0)
1973 while ((__den % 5) == 0)
1981 int __width = (__multiplicity_2 > __multiplicity_5
1982 ? __multiplicity_2 : __multiplicity_5);
1989 hh_mm_ss(_Duration __d,
bool __is_neg)
1990 : _M_is_neg(__is_neg),
1996 if constexpr (treat_as_floating_point_v<typename precision::rep>)
1999 _M_ss = duration_cast<precision>(__ss);
2002 static constexpr _Duration
2003 _S_abs(_Duration __d)
2005 if constexpr (numeric_limits<typename _Duration::rep>::is_signed)
2006 return chrono::abs(__d);
2012 static constexpr unsigned fractional_width = {_S_fractional_width()};
2016 chrono::seconds::rep>,
2017 ratio<1, __detail::__pow10(fractional_width)>>;
2021 : hh_mm_ss{_Duration::zero()}
2025 hh_mm_ss(_Duration __d)
2026 : hh_mm_ss(_S_abs(__d), __d < _Duration::zero())
2030 is_negative() const noexcept
2031 {
return _M_is_neg; }
2033 constexpr chrono::hours
2034 hours() const noexcept
2037 constexpr chrono::minutes
2041 constexpr chrono::seconds
2046 subseconds() const noexcept
2050 operator precision() const noexcept
2051 {
return to_duration(); }
2054 to_duration() const noexcept
2057 return -(_M_h + _M_m + _M_s + _M_ss);
2059 return _M_h + _M_m + _M_s + _M_ss;
2067 chrono::minutes _M_m;
2068 chrono::seconds _M_s;
2075 is_am(
const hours& __h)
noexcept
2076 {
return 0h <= __h && __h <= 11h; }
2079 is_pm(
const hours& __h)
noexcept
2080 {
return 12h <= __h && __h <= 23h; }
2083 make12(
const hours& __h)
noexcept
2093 make24(
const hours& __h,
bool __is_pm)
noexcept
2114#if __cplusplus >= 202002L
2115 inline namespace literals
2117 inline namespace chrono_literals
2121#pragma GCC diagnostic push
2122#pragma GCC diagnostic ignored "-Wliteral-suffix"
2125 constexpr chrono::day
2126 operator""d(
unsigned long long __d)
noexcept
2127 {
return chrono::day{
static_cast<unsigned>(__d)}; }
2131 constexpr chrono::year
2132 operator""y(
unsigned long long __y)
noexcept
2133 {
return chrono::year{
static_cast<int>(__y)}; }
2134#pragma GCC diagnostic pop
2147 template<
typename _Period>
2149 __units_suffix_misc(
char* __buf,
size_t __n)
noexcept
2154 unsigned __nlen = __tc::__to_chars_len((uintmax_t)_Period::num);
2155 __tc::__to_chars_10_impl(__p + 1, __nlen, (uintmax_t)_Period::num);
2157 if constexpr (_Period::den != 1)
2160 unsigned __dlen = __tc::__to_chars_len((uintmax_t)_Period::den);
2161 __tc::__to_chars_10_impl(__p + 1, __dlen, (uintmax_t)_Period::den);
2170 template<
typename _Period,
typename _CharT>
2172 __units_suffix(
char* __buf,
size_t __n)
noexcept
2174#define _GLIBCXX_UNITS_SUFFIX(period, suffix) \
2175 if constexpr (is_same_v<_Period, period>) \
2177 if constexpr (is_same_v<_CharT, wchar_t>) \
2184 _GLIBCXX_UNITS_SUFFIX(atto,
"as")
2185 _GLIBCXX_UNITS_SUFFIX(femto, "fs")
2186 _GLIBCXX_UNITS_SUFFIX(pico, "ps")
2187 _GLIBCXX_UNITS_SUFFIX(nano, "ns")
2188 _GLIBCXX_UNITS_SUFFIX(micro, "\u00b5s")
2189 _GLIBCXX_UNITS_SUFFIX(milli, "ms")
2190 _GLIBCXX_UNITS_SUFFIX(centi, "cs")
2191 _GLIBCXX_UNITS_SUFFIX(deci, "ds")
2192 _GLIBCXX_UNITS_SUFFIX(ratio<1>, "s")
2193 _GLIBCXX_UNITS_SUFFIX(deca, "das")
2194 _GLIBCXX_UNITS_SUFFIX(hecto, "hs")
2195 _GLIBCXX_UNITS_SUFFIX(kilo, "ks")
2196 _GLIBCXX_UNITS_SUFFIX(mega, "Ms")
2197 _GLIBCXX_UNITS_SUFFIX(giga, "Gs")
2198 _GLIBCXX_UNITS_SUFFIX(tera, "Ts")
2199 _GLIBCXX_UNITS_SUFFIX(tera, "Ts")
2200 _GLIBCXX_UNITS_SUFFIX(peta, "Ps")
2201 _GLIBCXX_UNITS_SUFFIX(exa, "Es")
2202 _GLIBCXX_UNITS_SUFFIX(ratio<60>, "min")
2203 _GLIBCXX_UNITS_SUFFIX(ratio<3600>, "h")
2204 _GLIBCXX_UNITS_SUFFIX(ratio<86400>, "d")
2205#undef _GLIBCXX_UNITS_SUFFIX
2206 return __detail::__units_suffix_misc<_Period>(__buf, __n);
2211 template<
typename _CharT,
typename _Traits,
2212 typename _Rep,
typename _Period>
2213 inline basic_ostream<_CharT, _Traits>&
2215 const duration<_Rep, _Period>& __d)
2217 using period =
typename _Period::type;
2218 char __buf[
sizeof(
"[/]s") + 2 * numeric_limits<intmax_t>::digits10];
2221 __s.imbue(__os.
getloc());
2224 __s << __detail::__units_suffix<period, _CharT>(__buf,
sizeof(__buf));
2235_GLIBCXX_END_NAMESPACE_VERSION
duration< int64_t > seconds
seconds
duration< int64_t, ratio< 3600 > > hours
hours
duration< int64_t, ratio< 86400 > > days
days
duration< int64_t, ratio< 60 > > minutes
minutes
constexpr time_point< _Clock, typename common_type< duration< _Rep1, _Period1 >, _Dur2 >::type > operator+(const duration< _Rep1, _Period1 > &__lhs, const time_point< _Clock, _Dur2 > &__rhs)
Adjust a time point forwards by the given duration.
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator-(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
The difference between two durations.
constexpr duration< __common_rep_t< _Rep1, __disable_if_is_duration< _Rep2 > >, _Period > operator/(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
duration< int64_t, ratio< 2629746 > > months
months
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration< int64_t, ratio< 31556952 > > years
years
constexpr complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
constexpr complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
typename make_unsigned< _Tp >::type make_unsigned_t
Alias template for make_unsigned.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
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.
Implementation details not part of the namespace std interface.
Template class basic_ostream.
Controlling output for std::string.
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.