30 #ifndef _GLIBCXX_CHRONO
31 #define _GLIBCXX_CHRONO 1
33 #pragma GCC system_header
35 #if __cplusplus < 201103L
44 #if __cplusplus > 201703L
49 namespace std _GLIBCXX_VISIBILITY(default)
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 #if __cplusplus >= 201703L
54 namespace filesystem {
struct __file_clock; };
70 template<
typename _Rep,
typename _Period = ratio<1>>
73 template<
typename _Clock,
typename _Dur =
typename _Clock::duration>
81 template<
typename _CT,
typename _Period1,
typename _Period2,
typename =
void>
82 struct __duration_common_type
85 template<
typename _CT,
typename _Period1,
typename _Period2>
86 struct __duration_common_type<_CT, _Period1, _Period2,
87 __void_t<typename _CT::type>>
90 using __gcd_num = __static_gcd<_Period1::num, _Period2::num>;
91 using __gcd_den = __static_gcd<_Period1::den, _Period2::den>;
92 using __cr =
typename _CT::type;
93 using __r = ratio<__gcd_num::value,
94 (_Period1::den / __gcd_den::value) * _Period2::den>;
97 using type = chrono::duration<__cr, typename __r::type>;
104 template<
typename _Rep1,
typename _Period1,
typename _Rep2,
typename _Period2>
107 : __duration_common_type<common_type<_Rep1, _Rep2>,
108 typename _Period1::type,
109 typename _Period2::type>
114 template<
typename _Rep,
typename _Period>
119 typename _Period::type>;
124 template<
typename _Rep,
typename _Period>
128 typename _Period::type>;
135 template<
typename _CT,
typename _Clock,
typename =
void>
136 struct __timepoint_common_type
139 template<
typename _CT,
typename _Clock>
140 struct __timepoint_common_type<_CT, _Clock, __void_t<typename _CT::type>>
142 using type = chrono::time_point<_Clock, typename _CT::type>;
149 template<
typename _Clock,
typename _Duration1,
typename _Duration2>
152 : __timepoint_common_type<common_type<_Duration1, _Duration2>, _Clock>
157 template<
typename _Clock,
typename _Duration>
164 template<
typename _Clock,
typename _Duration>
178 template<
typename _ToDur,
typename _CF,
typename _CR,
179 bool _NumIsOne =
false,
bool _DenIsOne =
false>
180 struct __duration_cast_impl
182 template<
typename _Rep,
typename _Period>
183 static constexpr _ToDur
184 __cast(
const duration<_Rep, _Period>& __d)
186 typedef typename _ToDur::rep __to_rep;
187 return _ToDur(
static_cast<__to_rep
>(
static_cast<_CR
>(__d.count())
188 *
static_cast<_CR
>(_CF::num)
189 /
static_cast<_CR
>(_CF::den)));
193 template<
typename _ToDur,
typename _CF,
typename _CR>
194 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
196 template<
typename _Rep,
typename _Period>
197 static constexpr _ToDur
198 __cast(
const duration<_Rep, _Period>& __d)
200 typedef typename _ToDur::rep __to_rep;
201 return _ToDur(
static_cast<__to_rep
>(__d.count()));
205 template<
typename _ToDur,
typename _CF,
typename _CR>
206 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
208 template<
typename _Rep,
typename _Period>
209 static constexpr _ToDur
210 __cast(
const duration<_Rep, _Period>& __d)
212 typedef typename _ToDur::rep __to_rep;
213 return _ToDur(
static_cast<__to_rep
>(
214 static_cast<_CR
>(__d.count()) /
static_cast<_CR
>(_CF::den)));
218 template<
typename _ToDur,
typename _CF,
typename _CR>
219 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
221 template<
typename _Rep,
typename _Period>
222 static constexpr _ToDur
223 __cast(
const duration<_Rep, _Period>& __d)
225 typedef typename _ToDur::rep __to_rep;
226 return _ToDur(
static_cast<__to_rep
>(
227 static_cast<_CR
>(__d.count()) *
static_cast<_CR
>(_CF::num)));
231 template<
typename _Tp>
236 template<
typename _Rep,
typename _Period>
237 struct __is_duration<duration<_Rep, _Period>>
241 template<
typename _Tp>
242 using __enable_if_is_duration
243 =
typename enable_if<__is_duration<_Tp>::value, _Tp>::type;
245 template<
typename _Tp>
246 using __disable_if_is_duration
247 =
typename enable_if<!__is_duration<_Tp>::value, _Tp>::type;
252 template<
typename _ToDur,
typename _Rep,
typename _Period>
253 constexpr __enable_if_is_duration<_ToDur>
256 typedef typename _ToDur::period __to_period;
257 typedef typename _ToDur::rep __to_rep;
261 typedef __duration_cast_impl<_ToDur, __cf, __cr,
262 __cf::num == 1, __cf::den == 1> __dc;
263 return __dc::__cast(__d);
267 template<
typename _Rep>
272 #if __cplusplus > 201402L
273 template <
typename _Rep>
274 inline constexpr
bool treat_as_floating_point_v =
278 #if __cplusplus > 201703L
279 template<
typename _Tp>
282 template<
typename _Tp>
283 inline constexpr
bool is_clock_v = is_clock<_Tp>::value;
285 #if __cpp_lib_concepts
286 template<
typename _Tp>
290 template<
typename _Tp>
293 typename _Tp::period;
294 typename _Tp::duration;
295 typename _Tp::time_point::clock;
296 typename _Tp::time_point::duration;
297 { &_Tp::is_steady } -> same_as<const bool*>;
298 { _Tp::now() } -> same_as<typename _Tp::time_point>;
299 requires same_as<
typename _Tp::duration,
300 duration<typename _Tp::rep, typename _Tp::period>>;
301 requires same_as<
typename _Tp::time_point::duration,
302 typename _Tp::duration>;
307 template<
typename _Tp,
typename =
void>
311 template<
typename _Tp>
312 struct __is_clock_impl<_Tp,
313 void_t<typename _Tp::rep, typename _Tp::period,
314 typename _Tp::duration,
315 typename _Tp::time_point::duration,
316 decltype(_Tp::is_steady),
317 decltype(_Tp::now())>>
318 : __and_<is_same<typename _Tp::duration,
319 duration<typename _Tp::rep, typename _Tp::period>>,
320 is_same<typename _Tp::time_point::duration,
321 typename _Tp::duration>,
322 is_same<decltype(&_Tp::is_steady), const bool*>,
323 is_same<decltype(_Tp::now()), typename _Tp::time_point>>::type
326 template<
typename _Tp>
327 struct is_clock : __is_clock_impl<_Tp>::type
332 #if __cplusplus >= 201703L
333 # define __cpp_lib_chrono 201611
335 template<
typename _ToDur,
typename _Rep,
typename _Period>
336 constexpr __enable_if_is_duration<_ToDur>
337 floor(
const duration<_Rep, _Period>& __d)
339 auto __to = chrono::duration_cast<_ToDur>(__d);
341 return __to - _ToDur{1};
345 template<
typename _ToDur,
typename _Rep,
typename _Period>
346 constexpr __enable_if_is_duration<_ToDur>
347 ceil(
const duration<_Rep, _Period>& __d)
349 auto __to = chrono::duration_cast<_ToDur>(__d);
351 return __to + _ToDur{1};
355 template <
typename _ToDur,
typename _Rep,
typename _Period>
357 __and_<__is_duration<_ToDur>,
358 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
360 round(
const duration<_Rep, _Period>& __d)
362 _ToDur __t0 = chrono::floor<_ToDur>(__d);
363 _ToDur __t1 = __t0 + _ToDur{1};
364 auto __diff0 = __d - __t0;
365 auto __diff1 = __t1 - __d;
366 if (__diff0 == __diff1)
368 if (__t0.count() & 1)
372 else if (__diff0 < __diff1)
377 template<
typename _Rep,
typename _Period>
379 enable_if_t<numeric_limits<_Rep>::is_signed, duration<_Rep, _Period>>
380 abs(duration<_Rep, _Period> __d)
382 if (__d >= __d.zero())
388 namespace __detail {
using chrono::ceil; }
397 template<
typename _Tp,
typename _Up>
399 __ceil_impl(
const _Tp& __t,
const _Up& __u)
401 return (__t < __u) ? (__t + _Tp{1}) : __t;
405 template<
typename _ToDur,
typename _Rep,
typename _Period>
407 ceil(
const duration<_Rep, _Period>& __d)
409 return __detail::__ceil_impl(chrono::duration_cast<_ToDur>(__d), __d);
415 template<
typename _Rep>
418 static constexpr _Rep
422 static constexpr _Rep
426 static constexpr _Rep
433 template<
typename _Tp>
438 template<
intmax_t _Num,
intmax_t _Den>
439 struct __is_ratio<
ratio<_Num, _Den>>
446 template<
typename _Rep,
typename _Period>
450 template<
typename _Rep2>
453 static constexpr intmax_t
454 _S_gcd(intmax_t __m, intmax_t __n) noexcept
458 #if __cplusplus >= 201402L
461 intmax_t __rem = __m % __n;
470 return (__n == 0) ? __m : _S_gcd(__n, __m % __n);
478 template<
typename _R1,
typename _R2,
479 intmax_t __gcd1 = _S_gcd(_R1::num, _R2::num),
480 intmax_t __gcd2 = _S_gcd(_R1::den, _R2::den)>
481 using __divide =
ratio<(_R1::num / __gcd1) * (_R2::den / __gcd2),
482 (_R1::den / __gcd2) * (_R2::num / __gcd1)>;
485 template<
typename _Period2>
487 = __bool_constant<__divide<_Period2, _Period>::den == 1>;
492 using period =
typename _Period::type;
494 static_assert(!__is_duration<_Rep>::value,
"rep cannot be a duration");
495 static_assert(__is_ratio<_Period>::value,
496 "period must be a specialization of ratio");
497 static_assert(_Period::num > 0,
"period must be positive");
506 template<
typename _Rep2,
typename = _Require<
508 __or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>>
509 constexpr
explicit duration(
const _Rep2& __rep)
510 : __r(
static_cast<rep
>(__rep)) { }
512 template<
typename _Rep2,
typename _Period2,
typename = _Require<
514 __or_<__is_float<rep>,
515 __and_<__is_harmonic<_Period2>,
516 __not_<__is_float<_Rep2>>>>>>
518 : __r(duration_cast<duration>(__d).count()) { }
575 operator*=(
const rep& __rhs)
582 operator/=(
const rep& __rhs)
589 template<
typename _Rep2 = rep>
593 operator%=(
const rep& __rhs)
599 template<
typename _Rep2 = rep>
629 template<
typename _Rep1,
typename _Period1,
630 typename _Rep2,
typename _Period2>
639 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
643 template<
typename _Rep1,
typename _Period1,
644 typename _Rep2,
typename _Period2>
653 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
664 template<
typename _Rep1,
typename _Rep2,
666 using __common_rep_t =
typename
674 template<
typename _Rep1,
typename _Period,
typename _Rep2>
680 return __cd(__cd(__d).count() * __s);
684 template<
typename _Rep1,
typename _Rep2,
typename _Period>
687 {
return __d * __s; }
689 template<
typename _Rep1,
typename _Period,
typename _Rep2>
696 return __cd(__cd(__d).count() / __s);
699 template<
typename _Rep1,
typename _Period1,
700 typename _Rep2,
typename _Period2>
702 operator/(
const duration<_Rep1, _Period1>& __lhs,
703 const duration<_Rep2, _Period2>& __rhs)
705 typedef duration<_Rep1, _Period1> __dur1;
706 typedef duration<_Rep2, _Period2> __dur2;
708 return __cd(__lhs).count() / __cd(__rhs).count();
712 template<
typename _Rep1,
typename _Period,
typename _Rep2>
714 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
715 operator%(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
717 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
719 return __cd(__cd(__d).count() % __s);
722 template<
typename _Rep1,
typename _Period1,
723 typename _Rep2,
typename _Period2>
724 constexpr
typename common_type<duration<_Rep1, _Period1>,
725 duration<_Rep2, _Period2>>::type
726 operator%(
const duration<_Rep1, _Period1>& __lhs,
727 const duration<_Rep2, _Period2>& __rhs)
729 typedef duration<_Rep1, _Period1> __dur1;
730 typedef duration<_Rep2, _Period2> __dur2;
731 typedef typename common_type<__dur1,__dur2>::type __cd;
732 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
737 template<
typename _Rep1,
typename _Period1,
738 typename _Rep2,
typename _Period2>
740 operator==(
const duration<_Rep1, _Period1>& __lhs,
741 const duration<_Rep2, _Period2>& __rhs)
743 typedef duration<_Rep1, _Period1> __dur1;
744 typedef duration<_Rep2, _Period2> __dur2;
745 typedef typename common_type<__dur1,__dur2>::type __ct;
746 return __ct(__lhs).count() == __ct(__rhs).count();
749 template<
typename _Rep1,
typename _Period1,
750 typename _Rep2,
typename _Period2>
752 operator<(
const duration<_Rep1, _Period1>& __lhs,
753 const duration<_Rep2, _Period2>& __rhs)
755 typedef duration<_Rep1, _Period1> __dur1;
756 typedef duration<_Rep2, _Period2> __dur2;
757 typedef typename common_type<__dur1,__dur2>::type __ct;
758 return __ct(__lhs).count() < __ct(__rhs).count();
761 #if __cpp_lib_three_way_comparison
762 template<
typename _Rep1,
typename _Period1,
763 typename _Rep2,
typename _Period2>
764 requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
766 operator<=>(
const duration<_Rep1, _Period1>& __lhs,
767 const duration<_Rep2, _Period2>& __rhs)
769 using __ct = common_type_t<duration<_Rep1, _Period1>,
770 duration<_Rep2, _Period2>>;
771 return __ct(__lhs).count() <=> __ct(__rhs).count();
774 template<
typename _Rep1,
typename _Period1,
775 typename _Rep2,
typename _Period2>
777 operator!=(
const duration<_Rep1, _Period1>& __lhs,
778 const duration<_Rep2, _Period2>& __rhs)
779 {
return !(__lhs == __rhs); }
782 template<
typename _Rep1,
typename _Period1,
783 typename _Rep2,
typename _Period2>
785 operator<=(
const duration<_Rep1, _Period1>& __lhs,
786 const duration<_Rep2, _Period2>& __rhs)
787 {
return !(__rhs < __lhs); }
789 template<
typename _Rep1,
typename _Period1,
790 typename _Rep2,
typename _Period2>
792 operator>(
const duration<_Rep1, _Period1>& __lhs,
793 const duration<_Rep2, _Period2>& __rhs)
794 {
return __rhs < __lhs; }
796 template<
typename _Rep1,
typename _Period1,
797 typename _Rep2,
typename _Period2>
799 operator>=(
const duration<_Rep1, _Period1>& __lhs,
800 const duration<_Rep2, _Period2>& __rhs)
801 {
return !(__lhs < __rhs); }
805 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
806 # define _GLIBCXX_CHRONO_INT64_T int64_t
807 #elif defined __INT64_TYPE__
808 # define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__
811 "Representation type for nanoseconds must have at least 64 bits");
812 # define _GLIBCXX_CHRONO_INT64_T long long
833 #if __cplusplus > 201703L
847 #undef _GLIBCXX_CHRONO_INT64_T
850 template<
typename _Clock,
typename _Dur>
853 static_assert(__is_duration<_Dur>::value,
854 "duration must be a specialization of std::chrono::duration");
856 typedef _Clock clock;
857 typedef _Dur duration;
858 typedef typename duration::rep rep;
859 typedef typename duration::period period;
861 constexpr
time_point() : __d(duration::zero())
864 constexpr
explicit time_point(
const duration& __dur)
869 template<
typename _Dur2,
870 typename = _Require<is_convertible<_Dur2, _Dur>>>
872 : __d(__t.time_since_epoch())
877 time_since_epoch()
const
880 #if __cplusplus > 201703L
906 operator+=(
const duration& __dur)
913 operator-=(
const duration& __dur)
933 template<
typename _ToDur,
typename _Clock,
typename _Dur>
939 return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
942 #if __cplusplus > 201402L
943 template<
typename _ToDur,
typename _Clock,
typename _Dur>
946 floor(
const time_point<_Clock, _Dur>& __tp)
948 return time_point<_Clock, _ToDur>{
949 chrono::floor<_ToDur>(__tp.time_since_epoch())};
952 template<
typename _ToDur,
typename _Clock,
typename _Dur>
954 enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
955 ceil(
const time_point<_Clock, _Dur>& __tp)
957 return time_point<_Clock, _ToDur>{
958 chrono::ceil<_ToDur>(__tp.time_since_epoch())};
961 template<
typename _ToDur,
typename _Clock,
typename _Dur>
963 __and_<__is_duration<_ToDur>,
964 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
965 time_point<_Clock, _ToDur>>
966 round(
const time_point<_Clock, _Dur>& __tp)
968 return time_point<_Clock, _ToDur>{
969 chrono::round<_ToDur>(__tp.time_since_epoch())};
976 template<
typename _Clock,
typename _Dur1,
977 typename _Rep2,
typename _Period2>
978 constexpr time_point<_Clock,
979 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
981 const duration<_Rep2, _Period2>& __rhs)
983 typedef duration<_Rep2, _Period2> __dur2;
986 return __time_point(__lhs.time_since_epoch() + __rhs);
990 template<
typename _Rep1,
typename _Period1,
991 typename _Clock,
typename _Dur2>
997 typedef duration<_Rep1, _Period1> __dur1;
1000 return __time_point(__rhs.time_since_epoch() + __lhs);
1004 template<
typename _Clock,
typename _Dur1,
1005 typename _Rep2,
typename _Period2>
1009 const duration<_Rep2, _Period2>& __rhs)
1011 typedef duration<_Rep2, _Period2> __dur2;
1014 return __time_point(__lhs.time_since_epoch() -__rhs);
1022 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1026 {
return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
1028 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1032 {
return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
1034 #if __cpp_lib_three_way_comparison
1035 template<
typename _Clock,
typename _Dur1,
1036 three_way_comparable_with<_Dur1> _Dur2>
1038 operator<=>(
const time_point<_Clock, _Dur1>& __lhs,
1039 const time_point<_Clock, _Dur2>& __rhs)
1040 {
return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); }
1042 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1044 operator!=(
const time_point<_Clock, _Dur1>& __lhs,
1045 const time_point<_Clock, _Dur2>& __rhs)
1046 {
return !(__lhs == __rhs); }
1049 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1051 operator<(
const time_point<_Clock, _Dur1>& __lhs,
1052 const time_point<_Clock, _Dur2>& __rhs)
1053 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
1055 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1057 operator<=(
const time_point<_Clock, _Dur1>& __lhs,
1058 const time_point<_Clock, _Dur2>& __rhs)
1059 {
return !(__rhs < __lhs); }
1061 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1063 operator>(
const time_point<_Clock, _Dur1>& __lhs,
1064 const time_point<_Clock, _Dur2>& __rhs)
1065 {
return __rhs < __lhs; }
1067 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1069 operator>=(
const time_point<_Clock, _Dur1>& __lhs,
1070 const time_point<_Clock, _Dur2>& __rhs)
1071 {
return !(__lhs < __rhs); }
1093 inline namespace _V2 {
1104 typedef duration::rep rep;
1105 typedef duration::period period;
1108 static_assert(system_clock::duration::min()
1109 < system_clock::duration::zero(),
1110 "a clock's minimum duration cannot be less than its epoch");
1112 static constexpr
bool is_steady =
false;
1121 return std::time_t(duration_cast<chrono::seconds>
1122 (__t.time_since_epoch()).count());
1126 from_time_t(std::time_t __t) noexcept
1129 return time_point_cast<system_clock::duration>
1144 typedef duration::rep rep;
1145 typedef duration::period period;
1148 static constexpr
bool is_steady =
true;
1167 #if __cplusplus > 201703L
1168 template<
typename _Duration>
1170 using sys_seconds = sys_time<seconds>;
1171 using sys_days = sys_time<days>;
1173 using file_clock = ::std::filesystem::__file_clock;
1175 template<
typename _Duration>
1179 template<>
struct is_clock<steady_clock> :
true_type { };
1180 template<>
struct is_clock<file_clock> :
true_type { };
1182 template<>
inline constexpr
bool is_clock_v<system_clock> =
true;
1183 template<>
inline constexpr
bool is_clock_v<steady_clock> =
true;
1184 template<>
inline constexpr
bool is_clock_v<file_clock> =
true;
1187 template<
typename _Duration>
1188 using local_time = time_point<local_t, _Duration>;
1189 using local_seconds = local_time<seconds>;
1190 using local_days = local_time<days>;
1196 template<
typename _Duration>
1197 using utc_time = time_point<utc_clock, _Duration>;
1198 using utc_seconds = utc_time<seconds>;
1200 template<
typename _Duration>
1201 using tai_time = time_point<tai_clock, _Duration>;
1202 using tai_seconds = tai_time<seconds>;
1204 template<
typename _Duration>
1205 using gps_time = time_point<gps_clock, _Duration>;
1206 using gps_seconds = gps_time<seconds>;
1208 template<>
struct is_clock<utc_clock> :
true_type { };
1209 template<>
struct is_clock<tai_clock> :
true_type { };
1210 template<>
struct is_clock<gps_clock> :
true_type { };
1212 template<>
inline constexpr
bool is_clock_v<utc_clock> =
true;
1213 template<>
inline constexpr
bool is_clock_v<tai_clock> =
true;
1214 template<>
inline constexpr
bool is_clock_v<gps_clock> =
true;
1216 struct leap_second_info
1218 bool is_leap_second;
1229 class weekday_indexed;
1232 class month_day_last;
1233 class month_weekday;
1234 class month_weekday_last;
1236 class year_month_day;
1237 class year_month_day_last;
1238 class year_month_weekday;
1239 class year_month_weekday_last;
1243 explicit last_spec() =
default;
1245 friend constexpr month_day_last
1248 friend constexpr month_day_last
1252 inline constexpr last_spec last{};
1262 __modulo(
long long __n,
unsigned __d)
1267 return (__d + (__n % __d)) % __d;
1270 inline constexpr
unsigned __days_per_month[12]
1271 = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
1285 day(
unsigned __d) noexcept
1290 operator++() noexcept
1297 operator++(
int) noexcept
1305 operator--() noexcept
1312 operator--(
int) noexcept
1320 operator+=(
const days& __d) noexcept
1322 *
this = *
this + __d;
1327 operator-=(
const days& __d) noexcept
1329 *
this = *
this - __d;
1334 operator unsigned() const noexcept
1339 {
return 1 <= _M_d && _M_d <= 31; }
1341 friend constexpr
bool
1342 operator==(
const day& __x,
const day& __y) noexcept
1343 {
return unsigned{__x} ==
unsigned{__y}; }
1345 friend constexpr strong_ordering
1346 operator<=>(
const day& __x,
const day& __y) noexcept
1347 {
return unsigned{__x} <=>
unsigned{__y}; }
1349 friend constexpr day
1350 operator+(
const day& __x,
const days& __y) noexcept
1351 {
return day(
unsigned{__x} + __y.count()); }
1353 friend constexpr day
1354 operator+(
const days& __x,
const day& __y) noexcept
1355 {
return __y + __x; }
1357 friend constexpr day
1358 operator-(
const day& __x,
const days& __y) noexcept
1359 {
return __x + -__y; }
1361 friend constexpr days
1362 operator-(
const day& __x,
const day& __y) noexcept
1363 {
return days{int(
unsigned{__x}) -
int(
unsigned{__y})}; }
1365 friend constexpr month_day
1366 operator/(
const month& __m,
const day& __d) noexcept;
1368 friend constexpr month_day
1369 operator/(
int __m,
const day& __d) noexcept;
1371 friend constexpr month_day
1372 operator/(
const day& __d,
const month& __m) noexcept;
1374 friend constexpr month_day
1375 operator/(
const day& __d,
int __m) noexcept;
1377 friend constexpr year_month_day
1378 operator/(
const year_month& __ym,
const day& __d) noexcept;
1394 month(
unsigned __m) noexcept
1399 operator++() noexcept
1406 operator++(
int) noexcept
1414 operator--() noexcept
1421 operator--(
int) noexcept
1429 operator+=(
const months& __m) noexcept
1431 *
this = *
this + __m;
1436 operator-=(
const months& __m) noexcept
1438 *
this = *
this - __m;
1443 operator unsigned() const noexcept
1448 {
return 1 <= _M_m && _M_m <= 12; }
1450 friend constexpr
bool
1451 operator==(
const month& __x,
const month& __y) noexcept
1452 {
return unsigned{__x} ==
unsigned{__y}; }
1454 friend constexpr strong_ordering
1455 operator<=>(
const month& __x,
const month& __y) noexcept
1456 {
return unsigned{__x} <=>
unsigned{__y}; }
1458 friend constexpr month
1459 operator+(
const month& __x,
const months& __y) noexcept
1461 auto __n =
static_cast<long long>(
unsigned{__x}) + (__y.count() - 1);
1462 return month{__detail::__modulo(__n, 12) + 1};
1465 friend constexpr month
1466 operator+(
const months& __x,
const month& __y) noexcept
1467 {
return __y + __x; }
1469 friend constexpr month
1470 operator-(
const month& __x,
const months& __y) noexcept
1471 {
return __x + -__y; }
1473 friend constexpr months
1474 operator-(
const month& __x,
const month& __y) noexcept
1476 const auto __dm = int(
unsigned(__x)) - int(
unsigned(__y));
1477 return months{__dm < 0 ? 12 + __dm : __dm};
1480 friend constexpr year_month
1481 operator/(
const year& __y,
const month& __m) noexcept;
1483 friend constexpr month_day
1484 operator/(
const month& __m,
int __d) noexcept;
1486 friend constexpr month_day_last
1487 operator/(
const month& __m, last_spec) noexcept;
1489 friend constexpr month_day_last
1490 operator/(last_spec,
const month& __m) noexcept;
1492 friend constexpr month_weekday
1493 operator/(
const month& __m,
const weekday_indexed& __wdi) noexcept;
1495 friend constexpr month_weekday
1496 operator/(
const weekday_indexed& __wdi,
const month& __m) noexcept;
1498 friend constexpr month_weekday_last
1499 operator/(
const month& __m,
const weekday_last& __wdl) noexcept;
1501 friend constexpr month_weekday_last
1502 operator/(
const weekday_last& __wdl,
const month& __m) noexcept;
1507 inline constexpr month January{1};
1508 inline constexpr month February{2};
1509 inline constexpr month March{3};
1510 inline constexpr month April{4};
1511 inline constexpr month May{5};
1512 inline constexpr month June{6};
1513 inline constexpr month July{7};
1514 inline constexpr month August{8};
1515 inline constexpr month September{9};
1516 inline constexpr month October{10};
1517 inline constexpr month November{11};
1518 inline constexpr month December{12};
1531 year(
int __y) noexcept
1532 : _M_y{
static_cast<short>(__y)}
1535 static constexpr year
1537 {
return year{-32767}; }
1539 static constexpr year
1541 {
return year{32767}; }
1544 operator++() noexcept
1551 operator++(
int) noexcept
1559 operator--() noexcept
1566 operator--(
int) noexcept
1574 operator+=(
const years& __y) noexcept
1576 *
this = *
this + __y;
1581 operator-=(
const years& __y) noexcept
1583 *
this = *
this - __y;
1593 {
return year{-_M_y}; }
1596 is_leap() const noexcept
1614 constexpr uint32_t __multiplier = 42949673;
1615 constexpr uint32_t __bound = 42949669;
1616 constexpr uint32_t __max_dividend = 1073741799;
1617 constexpr uint32_t __offset = __max_dividend / 2 / 100 * 100;
1618 const bool __is_multiple_of_100
1619 = __multiplier * (_M_y + __offset) < __bound;
1620 return (_M_y & (__is_multiple_of_100 ? 15 : 3)) == 0;
1624 operator int() const noexcept
1629 {
return min()._M_y <= _M_y && _M_y <=
max()._M_y; }
1631 friend constexpr
bool
1632 operator==(
const year& __x,
const year& __y) noexcept
1633 {
return int{__x} ==
int{__y}; }
1635 friend constexpr strong_ordering
1636 operator<=>(
const year& __x,
const year& __y) noexcept
1637 {
return int{__x} <=>
int{__y}; }
1639 friend constexpr year
1640 operator+(
const year& __x,
const years& __y) noexcept
1641 {
return year{
int{__x} +
static_cast<int>(__y.count())}; }
1643 friend constexpr year
1644 operator+(
const years& __x,
const year& __y) noexcept
1645 {
return __y + __x; }
1647 friend constexpr year
1648 operator-(
const year& __x,
const years& __y) noexcept
1649 {
return __x + -__y; }
1651 friend constexpr years
1652 operator-(
const year& __x,
const year& __y) noexcept
1653 {
return years{
int{__x} -
int{__y}}; }
1655 friend constexpr year_month
1656 operator/(
const year& __y,
int __m) noexcept;
1658 friend constexpr year_month_day
1659 operator/(
const year& __y,
const month_day& __md) noexcept;
1661 friend constexpr year_month_day
1662 operator/(
const month_day& __md,
const year& __y) noexcept;
1664 friend constexpr year_month_day_last
1665 operator/(
const year& __y,
const month_day_last& __mdl) noexcept;
1667 friend constexpr year_month_day_last
1668 operator/(
const month_day_last& __mdl,
const year& __y) noexcept;
1670 friend constexpr year_month_weekday
1671 operator/(
const year& __y,
const month_weekday& __mwd) noexcept;
1673 friend constexpr year_month_weekday
1674 operator/(
const month_weekday& __mwd,
const year& __y) noexcept;
1676 friend constexpr year_month_weekday_last
1677 operator/(
const year& __y,
const month_weekday_last& __mwdl) noexcept;
1679 friend constexpr year_month_weekday_last
1680 operator/(
const month_weekday_last& __mwdl,
const year& __y) noexcept;
1690 unsigned char _M_wd;
1692 static constexpr weekday
1693 _S_from_days(
const days& __d)
1695 auto __n = __d.count();
1696 return weekday(__n >= -4 ? (__n + 4) % 7 : (__n + 5) % 7 + 6);
1700 weekday() =
default;
1703 weekday(
unsigned __wd) noexcept
1704 : _M_wd(__wd == 7 ? 0 : __wd)
1708 weekday(
const sys_days& __dp) noexcept
1709 : weekday{_S_from_days(__dp.time_since_epoch())}
1713 weekday(
const local_days& __dp) noexcept
1714 : weekday{sys_days{__dp.time_since_epoch()}}
1718 operator++() noexcept
1725 operator++(
int) noexcept
1733 operator--() noexcept
1740 operator--(
int) noexcept
1748 operator+=(
const days& __d) noexcept
1750 *
this = *
this + __d;
1755 operator-=(
const days& __d) noexcept
1757 *
this = *
this - __d;
1762 c_encoding() const noexcept
1766 iso_encoding() const noexcept
1767 {
return _M_wd == 0u ? 7u : _M_wd; }
1771 {
return _M_wd <= 6; }
1773 constexpr weekday_indexed
1774 operator[](
unsigned __index)
const noexcept;
1776 constexpr weekday_last
1777 operator[](last_spec)
const noexcept;
1779 friend constexpr
bool
1780 operator==(
const weekday& __x,
const weekday& __y) noexcept
1781 {
return __x._M_wd == __y._M_wd; }
1783 friend constexpr weekday
1784 operator+(
const weekday& __x,
const days& __y) noexcept
1786 auto __n =
static_cast<long long>(__x._M_wd) + __y.count();
1787 return weekday{__detail::__modulo(__n, 7)};
1790 friend constexpr weekday
1791 operator+(
const days& __x,
const weekday& __y) noexcept
1792 {
return __y + __x; }
1794 friend constexpr weekday
1795 operator-(
const weekday& __x,
const days& __y) noexcept
1796 {
return __x + -__y; }
1798 friend constexpr days
1799 operator-(
const weekday& __x,
const weekday& __y) noexcept
1801 auto __n =
static_cast<long long>(__x._M_wd) - __y._M_wd;
1802 return days{__detail::__modulo(__n, 7)};
1808 inline constexpr weekday Sunday{0};
1809 inline constexpr weekday Monday{1};
1810 inline constexpr weekday Tuesday{2};
1811 inline constexpr weekday Wednesday{3};
1812 inline constexpr weekday Thursday{4};
1813 inline constexpr weekday Friday{5};
1814 inline constexpr weekday Saturday{6};
1818 class weekday_indexed
1821 chrono::weekday _M_wd;
1822 unsigned char _M_index;
1825 weekday_indexed() =
default;
1828 weekday_indexed(
const chrono::weekday& __wd,
unsigned __index) noexcept
1829 : _M_wd(__wd), _M_index(__index)
1832 constexpr chrono::weekday
1833 weekday() const noexcept
1837 index() const noexcept
1838 {
return _M_index; };
1842 {
return _M_wd.ok() && 1 <= _M_index && _M_index <= 5; }
1844 friend constexpr
bool
1845 operator==(
const weekday_indexed& __x,
const weekday_indexed& __y) noexcept
1846 {
return __x.weekday() == __y.weekday() && __x.index() == __y.index(); }
1848 friend constexpr month_weekday
1849 operator/(
const month& __m,
const weekday_indexed& __wdi) noexcept;
1851 friend constexpr month_weekday
1852 operator/(
int __m,
const weekday_indexed& __wdi) noexcept;
1854 friend constexpr month_weekday
1855 operator/(
const weekday_indexed& __wdi,
const month& __m) noexcept;
1857 friend constexpr month_weekday
1858 operator/(
const weekday_indexed& __wdi,
int __m) noexcept;
1860 friend constexpr year_month_weekday
1861 operator/(
const year_month& __ym,
const weekday_indexed& __wdi) noexcept;
1866 constexpr weekday_indexed
1867 weekday::operator[](
unsigned __index)
const noexcept
1868 {
return {*
this, __index}; }
1875 chrono::weekday _M_wd;
1879 weekday_last(
const chrono::weekday& __wd) noexcept
1883 constexpr chrono::weekday
1884 weekday() const noexcept
1889 {
return _M_wd.ok(); }
1891 friend constexpr
bool
1892 operator==(
const weekday_last& __x,
const weekday_last& __y) noexcept
1893 {
return __x.weekday() == __y.weekday(); }
1895 friend constexpr month_weekday_last
1896 operator/(
int __m,
const weekday_last& __wdl) noexcept;
1898 friend constexpr month_weekday_last
1899 operator/(
const weekday_last& __wdl,
int __m) noexcept;
1901 friend constexpr year_month_weekday_last
1902 operator/(
const year_month& __ym,
const weekday_last& __wdl) noexcept;
1907 constexpr weekday_last
1908 weekday::operator[](last_spec)
const noexcept
1909 {
return weekday_last{*
this}; }
1920 month_day() =
default;
1923 month_day(
const chrono::month& __m,
const chrono::day& __d) noexcept
1924 : _M_m{__m}, _M_d{__d}
1927 constexpr chrono::month
1928 month() const noexcept
1931 constexpr chrono::day
1932 day() const noexcept
1939 && 1u <= unsigned(_M_d)
1940 && unsigned(_M_d) <= __detail::__days_per_month[unsigned(_M_m) - 1];
1943 friend constexpr
bool
1944 operator==(
const month_day& __x,
const month_day& __y) noexcept
1945 {
return __x.month() == __y.month() && __x.day() == __y.day(); }
1947 friend constexpr strong_ordering
1948 operator<=>(
const month_day& __x,
const month_day& __y) noexcept
1951 friend constexpr month_day
1952 operator/(
const chrono::month& __m,
const chrono::day& __d) noexcept
1953 {
return {__m, __d}; }
1955 friend constexpr month_day
1956 operator/(
const chrono::month& __m,
int __d) noexcept
1957 {
return {__m, chrono::day(
unsigned(__d))}; }
1959 friend constexpr month_day
1960 operator/(
int __m,
const chrono::day& __d) noexcept
1961 {
return {chrono::month(
unsigned(__m)), __d}; }
1963 friend constexpr month_day
1964 operator/(
const chrono::day& __d,
const chrono::month& __m) noexcept
1965 {
return {__m, __d}; }
1967 friend constexpr month_day
1968 operator/(
const chrono::day& __d,
int __m) noexcept
1969 {
return {chrono::month(
unsigned(__m)), __d}; }
1971 friend constexpr year_month_day
1972 operator/(
int __y,
const month_day& __md) noexcept;
1974 friend constexpr year_month_day
1975 operator/(
const month_day& __md,
int __y) noexcept;
1982 class month_day_last
1989 month_day_last(
const chrono::month& __m) noexcept
1993 constexpr chrono::month
1994 month() const noexcept
1999 {
return _M_m.ok(); }
2001 friend constexpr
bool
2002 operator==(
const month_day_last& __x,
const month_day_last& __y) noexcept
2003 {
return __x.month() == __y.month(); }
2005 friend constexpr strong_ordering
2006 operator<=>(
const month_day_last& __x,
const month_day_last& __y) noexcept
2009 friend constexpr month_day_last
2010 operator/(
const chrono::month& __m, last_spec) noexcept
2011 {
return month_day_last{__m}; }
2013 friend constexpr month_day_last
2015 {
return chrono::month(
unsigned(__m)) / last; }
2017 friend constexpr month_day_last
2018 operator/(last_spec,
const chrono::month& __m) noexcept
2019 {
return __m / last; }
2021 friend constexpr month_day_last
2023 {
return __m / last; }
2025 friend constexpr year_month_day_last
2026 operator/(
int __y,
const month_day_last& __mdl) noexcept;
2028 friend constexpr year_month_day_last
2029 operator/(
const month_day_last& __mdl,
int __y) noexcept;
2040 chrono::weekday_indexed _M_wdi;
2044 month_weekday(
const chrono::month& __m,
2045 const chrono::weekday_indexed& __wdi) noexcept
2046 : _M_m{__m}, _M_wdi{__wdi}
2049 constexpr chrono::month
2050 month() const noexcept
2053 constexpr chrono::weekday_indexed
2054 weekday_indexed() const noexcept
2059 {
return _M_m.ok() && _M_wdi.ok(); }
2061 friend constexpr
bool
2062 operator==(
const month_weekday& __x,
const month_weekday& __y) noexcept
2064 return __x.month() == __y.month()
2065 && __x.weekday_indexed() == __y.weekday_indexed();
2068 friend constexpr month_weekday
2070 const chrono::weekday_indexed& __wdi) noexcept
2071 {
return {__m, __wdi}; }
2073 friend constexpr month_weekday
2074 operator/(
int __m,
const chrono::weekday_indexed& __wdi) noexcept
2075 {
return chrono::month(
unsigned(__m)) / __wdi; }
2077 friend constexpr month_weekday
2078 operator/(
const chrono::weekday_indexed& __wdi,
2079 const chrono::month& __m) noexcept
2080 {
return __m / __wdi; }
2082 friend constexpr month_weekday
2083 operator/(
const chrono::weekday_indexed& __wdi,
int __m) noexcept
2084 {
return __m / __wdi; }
2086 friend constexpr year_month_weekday
2087 operator/(
int __y,
const month_weekday& __mwd) noexcept;
2089 friend constexpr year_month_weekday
2090 operator/(
const month_weekday& __mwd,
int __y) noexcept;
2097 class month_weekday_last
2101 chrono::weekday_last _M_wdl;
2105 month_weekday_last(
const chrono::month& __m,
2106 const chrono::weekday_last& __wdl) noexcept
2107 :_M_m{__m}, _M_wdl{__wdl}
2110 constexpr chrono::month
2111 month() const noexcept
2114 constexpr chrono::weekday_last
2115 weekday_last() const noexcept
2120 {
return _M_m.ok() && _M_wdl.ok(); }
2122 friend constexpr
bool
2123 operator==(
const month_weekday_last& __x,
2124 const month_weekday_last& __y) noexcept
2126 return __x.month() == __y.month()
2127 && __x.weekday_last() == __y.weekday_last();
2130 friend constexpr month_weekday_last
2132 const chrono::weekday_last& __wdl) noexcept
2133 {
return {__m, __wdl}; }
2135 friend constexpr month_weekday_last
2136 operator/(
int __m,
const chrono::weekday_last& __wdl) noexcept
2137 {
return chrono::month(
unsigned(__m)) / __wdl; }
2139 friend constexpr month_weekday_last
2140 operator/(
const chrono::weekday_last& __wdl,
2141 const chrono::month& __m) noexcept
2142 {
return __m / __wdl; }
2144 friend constexpr month_weekday_last
2145 operator/(
const chrono::weekday_last& __wdl,
int __m) noexcept
2146 {
return chrono::month(
unsigned(__m)) / __wdl; }
2148 friend constexpr year_month_weekday_last
2149 operator/(
int __y,
const month_weekday_last& __mwdl) noexcept;
2151 friend constexpr year_month_weekday_last
2152 operator/(
const month_weekday_last& __mwdl,
int __y) noexcept;
2173 using __months_years_conversion_disambiguator = void;
2183 year_month() =
default;
2186 year_month(
const chrono::year& __y,
const chrono::month& __m) noexcept
2187 : _M_y{__y}, _M_m{__m}
2190 constexpr chrono::year
2191 year() const noexcept
2194 constexpr chrono::month
2195 month() const noexcept
2198 template<
typename = __detail::__months_years_conversion_disambiguator>
2199 constexpr year_month&
2200 operator+=(
const months& __dm) noexcept
2202 *
this = *
this + __dm;
2206 template<
typename = __detail::__months_years_conversion_disambiguator>
2207 constexpr year_month&
2208 operator-=(
const months& __dm) noexcept
2210 *
this = *
this - __dm;
2214 constexpr year_month&
2215 operator+=(
const years& __dy) noexcept
2217 *
this = *
this + __dy;
2221 constexpr year_month&
2222 operator-=(
const years& __dy) noexcept
2224 *
this = *
this - __dy;
2230 {
return _M_y.ok() && _M_m.ok(); }
2232 friend constexpr
bool
2233 operator==(
const year_month& __x,
const year_month& __y) noexcept
2234 {
return __x.year() == __y.year() && __x.month() == __y.month(); }
2236 friend constexpr strong_ordering
2237 operator<=>(
const year_month& __x,
const year_month& __y) noexcept
2240 template<
typename = __detail::__months_years_conversion_disambiguator>
2241 friend constexpr year_month
2242 operator+(
const year_month& __ym,
const months& __dm) noexcept
2245 auto __m = __ym.month() + __dm;
2246 auto __i = int(
unsigned(__ym.month())) - 1 + __dm.count();
2248 ? __ym.year() + years{(__i - 11) / 12}
2249 : __ym.year() + years{__i / 12});
2253 template<
typename = __detail::__months_years_conversion_disambiguator>
2254 friend constexpr year_month
2255 operator+(
const months& __dm,
const year_month& __ym) noexcept
2256 {
return __ym + __dm; }
2258 template<
typename = __detail::__months_years_conversion_disambiguator>
2259 friend constexpr year_month
2260 operator-(
const year_month& __ym,
const months& __dm) noexcept
2261 {
return __ym + -__dm; }
2263 friend constexpr months
2264 operator-(
const year_month& __x,
const year_month& __y) noexcept
2266 return (__x.year() - __y.year()
2267 + months{static_cast<int>(unsigned{__x.month()})
2268 -
static_cast<int>(
unsigned{__y.month()})});
2271 friend constexpr year_month
2272 operator+(
const year_month& __ym,
const years& __dy) noexcept
2273 {
return (__ym.year() + __dy) / __ym.month(); }
2275 friend constexpr year_month
2276 operator+(
const years& __dy,
const year_month& __ym) noexcept
2277 {
return __ym + __dy; }
2279 friend constexpr year_month
2280 operator-(
const year_month& __ym,
const years& __dy) noexcept
2281 {
return __ym + -__dy; }
2283 friend constexpr year_month
2284 operator/(
const chrono::year& __y,
const chrono::month& __m) noexcept
2285 {
return {__y, __m}; }
2287 friend constexpr year_month
2288 operator/(
const chrono::year& __y,
int __m) noexcept
2289 {
return {__y, chrono::month(
unsigned(__m))}; }
2291 friend constexpr year_month_day
2292 operator/(
const year_month& __ym,
int __d) noexcept;
2294 friend constexpr year_month_day_last
2295 operator/(
const year_month& __ym, last_spec) noexcept;
2302 class year_month_day
2309 static constexpr year_month_day _S_from_days(
const days& __dp) noexcept;
2311 constexpr days _M_days_since_epoch() const noexcept;
2314 year_month_day() = default;
2317 year_month_day(const chrono::year& __y, const chrono::month& __m,
2318 const chrono::day& __d) noexcept
2319 : _M_y{__y}, _M_m{__m}, _M_d{__d}
2323 year_month_day(
const year_month_day_last& __ymdl) noexcept;
2326 year_month_day(
const sys_days& __dp) noexcept
2327 : year_month_day(_S_from_days(__dp.time_since_epoch()))
2331 year_month_day(
const local_days& __dp) noexcept
2332 : year_month_day(sys_days{__dp.time_since_epoch()})
2335 template<
typename = __detail::__months_years_conversion_disambiguator>
2336 constexpr year_month_day&
2337 operator+=(
const months& __m) noexcept
2339 *
this = *
this + __m;
2343 template<
typename = __detail::__months_years_conversion_disambiguator>
2344 constexpr year_month_day&
2345 operator-=(
const months& __m) noexcept
2347 *
this = *
this - __m;
2351 constexpr year_month_day&
2352 operator+=(
const years& __y) noexcept
2354 *
this = *
this + __y;
2358 constexpr year_month_day&
2359 operator-=(
const years& __y) noexcept
2361 *
this = *
this - __y;
2365 constexpr chrono::year
2366 year() const noexcept
2369 constexpr chrono::month
2370 month() const noexcept
2373 constexpr chrono::day
2374 day() const noexcept
2378 operator sys_days() const noexcept
2379 {
return sys_days{_M_days_since_epoch()}; }
2382 operator local_days() const noexcept
2383 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2385 constexpr
bool ok() const noexcept;
2387 friend constexpr
bool
2388 operator==(const year_month_day& __x, const year_month_day& __y) noexcept
2390 return __x.year() == __y.year()
2391 && __x.month() == __y.month()
2392 && __x.day() == __y.day();
2395 friend constexpr strong_ordering
2396 operator<=>(
const year_month_day& __x,
const year_month_day& __y) noexcept
2399 template<
typename = __detail::__months_years_conversion_disambiguator>
2400 friend constexpr year_month_day
2401 operator+(
const year_month_day& __ymd,
const months& __dm) noexcept
2402 {
return (__ymd.year() / __ymd.month() + __dm) / __ymd.day(); }
2404 template<
typename = __detail::__months_years_conversion_disambiguator>
2405 friend constexpr year_month_day
2406 operator+(
const months& __dm,
const year_month_day& __ymd) noexcept
2407 {
return __ymd + __dm; }
2409 friend constexpr year_month_day
2410 operator+(
const year_month_day& __ymd,
const years& __dy) noexcept
2411 {
return (__ymd.year() + __dy) / __ymd.month() / __ymd.day(); }
2413 friend constexpr year_month_day
2414 operator+(
const years& __dy,
const year_month_day& __ymd) noexcept
2415 {
return __ymd + __dy; }
2417 template<
typename = __detail::__months_years_conversion_disambiguator>
2418 friend constexpr year_month_day
2419 operator-(
const year_month_day& __ymd,
const months& __dm) noexcept
2420 {
return __ymd + -__dm; }
2422 friend constexpr year_month_day
2423 operator-(
const year_month_day& __ymd,
const years& __dy) noexcept
2424 {
return __ymd + -__dy; }
2426 friend constexpr year_month_day
2427 operator/(
const year_month& __ym,
const chrono::day& __d) noexcept
2428 {
return {__ym.year(), __ym.month(), __d}; }
2430 friend constexpr year_month_day
2431 operator/(
const year_month& __ym,
int __d) noexcept
2432 {
return __ym / chrono::day{unsigned(__d)}; }
2434 friend constexpr year_month_day
2435 operator/(
const chrono::year& __y,
const month_day& __md) noexcept
2436 {
return __y / __md.month() / __md.day(); }
2438 friend constexpr year_month_day
2439 operator/(
int __y,
const month_day& __md) noexcept
2440 {
return chrono::year{__y} / __md; }
2442 friend constexpr year_month_day
2443 operator/(
const month_day& __md,
const chrono::year& __y) noexcept
2444 {
return __y / __md; }
2446 friend constexpr year_month_day
2447 operator/(
const month_day& __md,
int __y) noexcept
2448 {
return chrono::year(__y) / __md; }
2457 constexpr year_month_day
2458 year_month_day::_S_from_days(
const days& __dp) noexcept
2460 constexpr
auto __z2 =
static_cast<uint32_t
>(-1468000);
2461 constexpr
auto __r2_e3 =
static_cast<uint32_t
>(536895458);
2463 const auto __r0 =
static_cast<uint32_t
>(__dp.count()) + __r2_e3;
2465 const auto __n1 = 4 * __r0 + 3;
2466 const auto __q1 = __n1 / 146097;
2467 const auto __r1 = __n1 % 146097 / 4;
2469 constexpr
auto __p32 =
static_cast<uint64_t
>(1) << 32;
2470 const auto __n2 = 4 * __r1 + 3;
2471 const auto __u2 =
static_cast<uint64_t
>(2939745) * __n2;
2472 const auto __q2 =
static_cast<uint32_t
>(__u2 / __p32);
2473 const auto __r2 =
static_cast<uint32_t
>(__u2 % __p32) / 2939745 / 4;
2475 constexpr
auto __p16 =
static_cast<uint32_t
>(1) << 16;
2476 const auto __n3 = 2141 * __r2 + 197913;
2477 const auto __q3 = __n3 / __p16;
2478 const auto __r3 = __n3 % __p16 / 2141;
2480 const auto __y0 = 100 * __q1 + __q2;
2481 const auto __m0 = __q3;
2482 const auto __d0 = __r3;
2484 const auto __j = __r2 >= 306;
2485 const auto __y1 = __y0 + __j;
2486 const auto __m1 = __j ? __m0 - 12 : __m0;
2487 const auto __d1 = __d0 + 1;
2489 return year_month_day{chrono::year{
static_cast<int>(__y1 + __z2)},
2490 chrono::month{__m1}, chrono::day{__d1}};
2498 year_month_day::_M_days_since_epoch() const noexcept
2500 auto constexpr __z2 =
static_cast<uint32_t
>(-1468000);
2501 auto constexpr __r2_e3 =
static_cast<uint32_t
>(536895458);
2503 const auto __y1 =
static_cast<uint32_t
>(
static_cast<int>(_M_y)) - __z2;
2504 const auto __m1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_m));
2505 const auto __d1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_d));
2507 const auto __j =
static_cast<uint32_t
>(__m1 < 3);
2508 const auto __y0 = __y1 - __j;
2509 const auto __m0 = __j ? __m1 + 12 : __m1;
2510 const auto __d0 = __d1 - 1;
2512 const auto __q1 = __y0 / 100;
2513 const auto __yc = 1461 * __y0 / 4 - __q1 + __q1 / 4;
2514 const auto __mc = (979 *__m0 - 2919) / 32;
2515 const auto __dc = __d0;
2517 return days{
static_cast<int32_t
>(__yc + __mc + __dc - __r2_e3)};
2522 class year_month_day_last
2526 chrono::month_day_last _M_mdl;
2530 year_month_day_last(
const chrono::year& __y,
2531 const chrono::month_day_last& __mdl) noexcept
2532 : _M_y{__y}, _M_mdl{__mdl}
2535 template<
typename = __detail::__months_years_conversion_disambiguator>
2536 constexpr year_month_day_last&
2537 operator+=(
const months& __m) noexcept
2539 *
this = *
this + __m;
2543 template<
typename = __detail::__months_years_conversion_disambiguator>
2544 constexpr year_month_day_last&
2545 operator-=(
const months& __m) noexcept
2547 *
this = *
this - __m;
2551 constexpr year_month_day_last&
2552 operator+=(
const years& __y) noexcept
2554 *
this = *
this + __y;
2558 constexpr year_month_day_last&
2559 operator-=(
const years& __y) noexcept
2561 *
this = *
this - __y;
2565 constexpr chrono::year
2566 year() const noexcept
2569 constexpr chrono::month
2570 month() const noexcept
2571 {
return _M_mdl.month(); }
2573 constexpr chrono::month_day_last
2574 month_day_last() const noexcept
2578 constexpr chrono::day
2579 day() const noexcept
2581 const auto __m =
static_cast<unsigned>(month());
2597 return chrono::day{__m != 2 ? ((__m ^ (__m >> 3)) & 1) | 30
2598 : _M_y.is_leap() ? 29 : 28};
2602 operator sys_days() const noexcept
2603 {
return sys_days{year() / month() / day()}; }
2606 operator local_days() const noexcept
2607 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2611 {
return _M_y.ok() && _M_mdl.ok(); }
2613 friend constexpr
bool
2614 operator==(
const year_month_day_last& __x,
2615 const year_month_day_last& __y) noexcept
2617 return __x.year() == __y.year()
2618 && __x.month_day_last() == __y.month_day_last();
2621 friend constexpr strong_ordering
2622 operator<=>(
const year_month_day_last& __x,
2623 const year_month_day_last& __y) noexcept
2626 template<
typename = __detail::__months_years_conversion_disambiguator>
2627 friend constexpr year_month_day_last
2628 operator+(
const year_month_day_last& __ymdl,
2629 const months& __dm) noexcept
2630 {
return (__ymdl.year() / __ymdl.month() + __dm) / last; }
2632 template<
typename = __detail::__months_years_conversion_disambiguator>
2633 friend constexpr year_month_day_last
2635 const year_month_day_last& __ymdl) noexcept
2636 {
return __ymdl + __dm; }
2638 template<
typename = __detail::__months_years_conversion_disambiguator>
2639 friend constexpr year_month_day_last
2640 operator-(
const year_month_day_last& __ymdl,
2641 const months& __dm) noexcept
2642 {
return __ymdl + -__dm; }
2644 friend constexpr year_month_day_last
2645 operator+(
const year_month_day_last& __ymdl,
2646 const years& __dy) noexcept
2647 {
return {__ymdl.year() + __dy, __ymdl.month_day_last()}; }
2649 friend constexpr year_month_day_last
2651 const year_month_day_last& __ymdl) noexcept
2652 {
return __ymdl + __dy; }
2654 friend constexpr year_month_day_last
2655 operator-(
const year_month_day_last& __ymdl,
2656 const years& __dy) noexcept
2657 {
return __ymdl + -__dy; }
2659 friend constexpr year_month_day_last
2660 operator/(
const year_month& __ym, last_spec) noexcept
2661 {
return {__ym.year(), chrono::month_day_last{__ym.month()}}; }
2663 friend constexpr year_month_day_last
2665 const chrono::month_day_last& __mdl) noexcept
2666 {
return {__y, __mdl}; }
2668 friend constexpr year_month_day_last
2669 operator/(
int __y,
const chrono::month_day_last& __mdl) noexcept
2670 {
return chrono::year(__y) / __mdl; }
2672 friend constexpr year_month_day_last
2673 operator/(
const chrono::month_day_last& __mdl,
2674 const chrono::year& __y) noexcept
2675 {
return __y / __mdl; }
2677 friend constexpr year_month_day_last
2678 operator/(
const chrono::month_day_last& __mdl,
int __y) noexcept
2679 {
return chrono::year(__y) / __mdl; }
2686 year_month_day::year_month_day(
const year_month_day_last& __ymdl) noexcept
2687 : _M_y{__ymdl.year()}, _M_m{__ymdl.month()}, _M_d{__ymdl.day()}
2691 year_month_day::ok() const noexcept
2693 if (!_M_y.ok() || !_M_m.ok())
2695 return chrono::day{1} <= _M_d && _M_d <= (_M_y / _M_m / last).day();
2700 class year_month_weekday
2705 chrono::weekday_indexed _M_wdi;
2707 static constexpr year_month_weekday
2708 _S_from_sys_days(
const sys_days& __dp)
2710 year_month_day __ymd{__dp};
2711 chrono::weekday __wd{__dp};
2712 auto __index = __wd[(
unsigned{__ymd.day()} - 1) / 7 + 1];
2713 return {__ymd.year(), __ymd.month(), __index};
2717 year_month_weekday() =
default;
2720 year_month_weekday(
const chrono::year& __y,
const chrono::month& __m,
2721 const chrono::weekday_indexed& __wdi) noexcept
2722 : _M_y{__y}, _M_m{__m}, _M_wdi{__wdi}
2726 year_month_weekday(
const sys_days& __dp) noexcept
2727 : year_month_weekday{_S_from_sys_days(__dp)}
2731 year_month_weekday(
const local_days& __dp) noexcept
2732 : year_month_weekday{sys_days{__dp.time_since_epoch()}}
2735 template<
typename = __detail::__months_years_conversion_disambiguator>
2736 constexpr year_month_weekday&
2737 operator+=(
const months& __m) noexcept
2739 *
this = *
this + __m;
2743 template<
typename = __detail::__months_years_conversion_disambiguator>
2744 constexpr year_month_weekday&
2745 operator-=(
const months& __m) noexcept
2747 *
this = *
this - __m;
2751 constexpr year_month_weekday&
2752 operator+=(
const years& __y) noexcept
2754 *
this = *
this + __y;
2758 constexpr year_month_weekday&
2759 operator-=(
const years& __y) noexcept
2761 *
this = *
this - __y;
2765 constexpr chrono::year
2766 year() const noexcept
2769 constexpr chrono::month
2770 month() const noexcept
2773 constexpr chrono::weekday
2774 weekday() const noexcept
2775 {
return _M_wdi.weekday(); }
2778 index() const noexcept
2779 {
return _M_wdi.index(); }
2781 constexpr chrono::weekday_indexed
2782 weekday_indexed() const noexcept
2786 operator sys_days() const noexcept
2788 auto __d = sys_days{year() / month() / 1};
2789 return __d + (weekday() - chrono::weekday(__d)
2790 + days{(
static_cast<int>(index())-1)*7});
2794 operator local_days() const noexcept
2795 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2800 if (!_M_y.ok() || !_M_m.ok() || !_M_wdi.ok())
2802 if (_M_wdi.index() <= 4)
2804 days __d = (_M_wdi.weekday()
2805 - chrono::weekday{sys_days{_M_y / _M_m / 1}}
2806 + days((_M_wdi.index()-1)*7 + 1));
2807 __glibcxx_assert(__d.count() >= 1);
2808 return __d.count() <=
unsigned{(_M_y / _M_m / last).day()};
2811 friend constexpr
bool
2812 operator==(
const year_month_weekday& __x,
2813 const year_month_weekday& __y) noexcept
2815 return __x.year() == __y.year()
2816 && __x.month() == __y.month()
2817 && __x.weekday_indexed() == __y.weekday_indexed();
2820 template<
typename = __detail::__months_years_conversion_disambiguator>
2821 friend constexpr year_month_weekday
2822 operator+(
const year_month_weekday& __ymwd,
const months& __dm) noexcept
2824 return ((__ymwd.year() / __ymwd.month() + __dm)
2825 / __ymwd.weekday_indexed());
2828 template<
typename = __detail::__months_years_conversion_disambiguator>
2829 friend constexpr year_month_weekday
2830 operator+(
const months& __dm,
const year_month_weekday& __ymwd) noexcept
2831 {
return __ymwd + __dm; }
2833 friend constexpr year_month_weekday
2834 operator+(
const year_month_weekday& __ymwd,
const years& __dy) noexcept
2835 {
return {__ymwd.year() + __dy, __ymwd.month(), __ymwd.weekday_indexed()}; }
2837 friend constexpr year_month_weekday
2838 operator+(
const years& __dy,
const year_month_weekday& __ymwd) noexcept
2839 {
return __ymwd + __dy; }
2841 template<
typename = __detail::__months_years_conversion_disambiguator>
2842 friend constexpr year_month_weekday
2843 operator-(
const year_month_weekday& __ymwd,
const months& __dm) noexcept
2844 {
return __ymwd + -__dm; }
2846 friend constexpr year_month_weekday
2847 operator-(
const year_month_weekday& __ymwd,
const years& __dy) noexcept
2848 {
return __ymwd + -__dy; }
2850 friend constexpr year_month_weekday
2852 const chrono::weekday_indexed& __wdi) noexcept
2853 {
return {__ym.year(), __ym.month(), __wdi}; }
2855 friend constexpr year_month_weekday
2856 operator/(
const chrono::year& __y,
const month_weekday& __mwd) noexcept
2857 {
return {__y, __mwd.month(), __mwd.weekday_indexed()}; }
2859 friend constexpr year_month_weekday
2860 operator/(
int __y,
const month_weekday& __mwd) noexcept
2861 {
return chrono::year(__y) / __mwd; }
2863 friend constexpr year_month_weekday
2864 operator/(
const month_weekday& __mwd,
const chrono::year& __y) noexcept
2865 {
return __y / __mwd; }
2867 friend constexpr year_month_weekday
2868 operator/(
const month_weekday& __mwd,
int __y) noexcept
2869 {
return chrono::year(__y) / __mwd; }
2876 class year_month_weekday_last
2881 chrono::weekday_last _M_wdl;
2885 year_month_weekday_last(
const chrono::year& __y,
const chrono::month& __m,
2886 const chrono::weekday_last& __wdl) noexcept
2887 : _M_y{__y}, _M_m{__m}, _M_wdl{__wdl}
2890 template<
typename = __detail::__months_years_conversion_disambiguator>
2891 constexpr year_month_weekday_last&
2892 operator+=(
const months& __m) noexcept
2894 *
this = *
this + __m;
2898 template<
typename = __detail::__months_years_conversion_disambiguator>
2899 constexpr year_month_weekday_last&
2900 operator-=(
const months& __m) noexcept
2902 *
this = *
this - __m;
2906 constexpr year_month_weekday_last&
2907 operator+=(
const years& __y) noexcept
2909 *
this = *
this + __y;
2913 constexpr year_month_weekday_last&
2914 operator-=(
const years& __y) noexcept
2916 *
this = *
this - __y;
2920 constexpr chrono::year
2921 year() const noexcept
2924 constexpr chrono::month
2925 month() const noexcept
2928 constexpr chrono::weekday
2929 weekday() const noexcept
2930 {
return _M_wdl.weekday(); }
2932 constexpr chrono::weekday_last
2933 weekday_last() const noexcept
2937 operator sys_days() const noexcept
2939 const auto __d = sys_days{_M_y / _M_m / last};
2940 return sys_days{(__d - (chrono::weekday{__d}
2941 - _M_wdl.weekday())).time_since_epoch()};
2945 operator local_days() const noexcept
2946 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2950 {
return _M_y.ok() && _M_m.ok() && _M_wdl.ok(); }
2952 friend constexpr
bool
2953 operator==(
const year_month_weekday_last& __x,
2954 const year_month_weekday_last& __y) noexcept
2956 return __x.year() == __y.year()
2957 && __x.month() == __y.month()
2958 && __x.weekday_last() == __y.weekday_last();
2961 template<
typename = __detail::__months_years_conversion_disambiguator>
2962 friend constexpr year_month_weekday_last
2963 operator+(
const year_month_weekday_last& __ymwdl,
2964 const months& __dm) noexcept
2966 return ((__ymwdl.year() / __ymwdl.month() + __dm)
2967 / __ymwdl.weekday_last());
2970 template<
typename = __detail::__months_years_conversion_disambiguator>
2971 friend constexpr year_month_weekday_last
2973 const year_month_weekday_last& __ymwdl) noexcept
2974 {
return __ymwdl + __dm; }
2976 friend constexpr year_month_weekday_last
2977 operator+(
const year_month_weekday_last& __ymwdl,
2978 const years& __dy) noexcept
2979 {
return {__ymwdl.year() + __dy, __ymwdl.month(), __ymwdl.weekday_last()}; }
2981 friend constexpr year_month_weekday_last
2983 const year_month_weekday_last& __ymwdl) noexcept
2984 {
return __ymwdl + __dy; }
2986 template<
typename = __detail::__months_years_conversion_disambiguator>
2987 friend constexpr year_month_weekday_last
2988 operator-(
const year_month_weekday_last& __ymwdl,
2989 const months& __dm) noexcept
2990 {
return __ymwdl + -__dm; }
2992 friend constexpr year_month_weekday_last
2993 operator-(
const year_month_weekday_last& __ymwdl,
2994 const years& __dy) noexcept
2995 {
return __ymwdl + -__dy; }
2997 friend constexpr year_month_weekday_last
2999 const chrono::weekday_last& __wdl) noexcept
3000 {
return {__ym.year(), __ym.month(), __wdl}; }
3002 friend constexpr year_month_weekday_last
3004 const chrono::month_weekday_last& __mwdl) noexcept
3005 {
return {__y, __mwdl.month(), __mwdl.weekday_last()}; }
3007 friend constexpr year_month_weekday_last
3008 operator/(
int __y,
const chrono::month_weekday_last& __mwdl) noexcept
3009 {
return chrono::year(__y) / __mwdl; }
3011 friend constexpr year_month_weekday_last
3012 operator/(
const chrono::month_weekday_last& __mwdl,
3013 const chrono::year& __y) noexcept
3014 {
return __y / __mwdl; }
3016 friend constexpr year_month_weekday_last
3017 operator/(
const chrono::month_weekday_last& __mwdl,
int __y) noexcept
3018 {
return chrono::year(__y) / __mwdl; }
3028 __pow10(
unsigned __n)
3037 template<
typename _Duration>
3041 static constexpr
int
3042 _S_fractional_width()
3044 int __multiplicity_2 = 0;
3045 int __multiplicity_5 = 0;
3046 auto __den = _Duration::period::den;
3047 while ((__den % 2) == 0)
3052 while ((__den % 5) == 0)
3060 int __width = (__multiplicity_2 > __multiplicity_5
3061 ? __multiplicity_2 : __multiplicity_5);
3068 static constexpr
unsigned fractional_width = {_S_fractional_width()};
3072 chrono::seconds::rep>,
3073 ratio<1, __detail::__pow10(fractional_width)>>;
3077 : hh_mm_ss{_Duration::zero()}
3081 hh_mm_ss(_Duration __d) noexcept
3082 : _M_is_neg (__d < _Duration::zero()),
3083 _M_h (duration_cast<chrono::hours>(abs(__d))),
3084 _M_m (duration_cast<chrono::minutes>(abs(__d) -
hours())),
3085 _M_s (duration_cast<chrono::seconds>(abs(__d) -
hours() -
minutes()))
3087 if constexpr (treat_as_floating_point_v<typename precision::rep>)
3090 _M_ss = duration_cast<precision>(abs(__d) -
hours()
3095 is_negative() const noexcept
3096 {
return _M_is_neg; }
3099 hours() const noexcept
3111 subseconds() const noexcept
3115 operator precision() const noexcept
3116 {
return to_duration(); }
3119 to_duration() const noexcept
3122 return -(_M_h + _M_m + _M_s + _M_ss);
3124 return _M_h + _M_m + _M_s + _M_ss;
3141 #if __cplusplus > 201103L
3143 #define __cpp_lib_chrono_udls 201304
3145 inline namespace literals
3170 inline namespace chrono_literals
3172 #pragma GCC diagnostic push
3173 #pragma GCC diagnostic ignored "-Wliteral-suffix"
3175 template<
typename _Dur,
char... _Digits>
3176 constexpr _Dur __check_overflow()
3178 using _Val = __parse_int::_Parse_int<_Digits...>;
3179 constexpr
typename _Dur::rep __repval = _Val::value;
3180 static_assert(__repval >= 0 && __repval == _Val::value,
3181 "literal value cannot be represented by duration type");
3182 return _Dur(__repval);
3188 operator""h(
long double __hours)
3192 template <
char... _Digits>
3199 operator""min(
long double __mins)
3203 template <
char... _Digits>
3210 operator""s(
long double __secs)
3214 template <
char... _Digits>
3221 operator""ms(
long double __msecs)
3225 template <
char... _Digits>
3232 operator""us(
long double __usecs)
3236 template <
char... _Digits>
3243 operator""ns(
long double __nsecs)
3247 template <
char... _Digits>
3252 #if __cplusplus > 201703L
3253 constexpr chrono::day
3254 operator""d(
unsigned long long __d) noexcept
3255 {
return chrono::day{
static_cast<unsigned>(__d)}; }
3257 constexpr chrono::year
3258 operator""y(
unsigned long long __y) noexcept
3259 {
return chrono::year{
static_cast<int>(__y)}; }
3262 #pragma GCC diagnostic pop
3268 using namespace literals::chrono_literals;
3271 #if __cplusplus > 201703L
3277 is_am(
const hours& __h) noexcept
3278 {
return 0h <= __h && __h <= 11h; }
3281 is_pm(
const hours& __h) noexcept
3282 {
return 12h <= __h && __h <= 23h; }
3285 make12(
const hours& __h) noexcept
3295 make24(
const hours& __h,
bool __is_pm) noexcept
3315 #if __cplusplus >= 201703L
3316 namespace filesystem
3321 using rep = duration::rep;
3322 using period = duration::period;
3323 using time_point = chrono::time_point<__file_clock>;
3324 static constexpr
bool is_steady =
false;
3328 {
return _S_from_sys(chrono::system_clock::now()); }
3330 #if __cplusplus > 201703L
3331 template<
typename _Dur>
3333 chrono::file_time<_Dur>
3334 from_sys(
const chrono::sys_time<_Dur>& __t) noexcept
3335 {
return _S_from_sys(__t); }
3338 template<
typename _Dur>
3340 chrono::sys_time<_Dur>
3341 to_sys(
const chrono::file_time<_Dur>& __t) noexcept
3342 {
return _S_to_sys(__t); }
3346 using __sys_clock = chrono::system_clock;
3355 template<
typename _Dur>
3357 chrono::time_point<__file_clock, _Dur>
3358 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
3360 using __file_time = chrono::time_point<__file_clock, _Dur>;
3361 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
3365 template<
typename _Dur>
3367 chrono::time_point<__sys_clock, _Dur>
3368 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t) noexcept
3370 using __sys_time = chrono::time_point<__sys_clock, _Dur>;
3371 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
3378 _GLIBCXX_END_NAMESPACE_VERSION
constexpr duration< __common_rep_t< _Rep2, _Rep1 >, _Period > operator*(const _Rep1 &__s, const duration< _Rep2, _Period > &__d)
Multiply a duration by a scalar value.
duration< int64_t, milli > milliseconds
milliseconds
constexpr enable_if< __is_duration< _ToDur >::value, time_point< _Clock, _ToDur > >::type time_point_cast(const time_point< _Clock, _Dur > &__t)
time_point_cast
constexpr time_point< _Clock, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator-(const time_point< _Clock, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Adjust a time point backwards by the given duration.
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration_cast
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.
duration< int64_t, ratio< 3600 > > hours
hours
constexpr time_point< _Clock, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator+(const time_point< _Clock, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t, ratio< 60 > > minutes
minutes
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator+(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
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.
duration< int64_t, nano > nanoseconds
nanoseconds
constexpr common_type< _Dur1, _Dur2 >::type operator-(const time_point< _Clock, _Dur1 > &__lhs, const time_point< _Clock, _Dur2 > &__rhs)
constexpr duration< __common_rep_t< _Rep1, _Rep2 >, _Period > operator*(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
duration< int64_t, micro > microseconds
microseconds
duration< int64_t > seconds
seconds
constexpr complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
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.
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
void void_t
A metafunction that always yields void, used for detecting valid types.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
ISO C++ entities toplevel namespace is std.
Properties of fundamental types.
static constexpr _Tp max() noexcept
static constexpr _Tp lowest() noexcept
Provides compile-time rational arithmetic.
Define a member typedef type only if a boolean constant is true.