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; };
76 template<
typename _Rep,
typename _Period = ratio<1>>
80 template<
typename _Clock,
typename _Dur =
typename _Clock::duration>
92 template<
typename _CT,
typename _Period1,
typename _Period2,
typename =
void>
93 struct __duration_common_type
96 template<
typename _CT,
typename _Period1,
typename _Period2>
97 struct __duration_common_type<_CT, _Period1, _Period2,
98 __void_t<typename _CT::type>>
101 using __gcd_num = __static_gcd<_Period1::num, _Period2::num>;
102 using __gcd_den = __static_gcd<_Period1::den, _Period2::den>;
103 using __cr =
typename _CT::type;
104 using __r =
ratio<__gcd_num::value,
105 (_Period1::den / __gcd_den::value) * _Period2::den>;
117 template<
typename _Rep1,
typename _Period1,
typename _Rep2,
typename _Period2>
120 : __duration_common_type<common_type<_Rep1, _Rep2>,
121 typename _Period1::type,
122 typename _Period2::type>
126 template<
typename _Rep,
typename _Period>
131 typename _Period::type>;
135 template<
typename _Rep,
typename _Period>
139 typename _Period::type>;
147 template<
typename _CT,
typename _Clock,
typename =
void>
148 struct __timepoint_common_type
151 template<
typename _CT,
typename _Clock>
152 struct __timepoint_common_type<_CT, _Clock, __void_t<typename _CT::type>>
154 using type = chrono::time_point<_Clock, typename _CT::type>;
163 template<
typename _Clock,
typename _Duration1,
typename _Duration2>
166 : __timepoint_common_type<common_type<_Duration1, _Duration2>, _Clock>
170 template<
typename _Clock,
typename _Duration>
176 template<
typename _Clock,
typename _Duration>
191 template<
typename _ToDur,
typename _CF,
typename _CR,
192 bool _NumIsOne =
false,
bool _DenIsOne =
false>
193 struct __duration_cast_impl
195 template<
typename _Rep,
typename _Period>
196 static constexpr _ToDur
197 __cast(
const duration<_Rep, _Period>& __d)
199 typedef typename _ToDur::rep __to_rep;
200 return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
201 * static_cast<_CR>(_CF::num)
202 /
static_cast<_CR
>(_CF::den)));
206 template<
typename _ToDur,
typename _CF,
typename _CR>
207 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
209 template<
typename _Rep,
typename _Period>
210 static constexpr _ToDur
211 __cast(
const duration<_Rep, _Period>& __d)
213 typedef typename _ToDur::rep __to_rep;
214 return _ToDur(static_cast<__to_rep>(__d.count()));
218 template<
typename _ToDur,
typename _CF,
typename _CR>
219 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
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::den)));
231 template<
typename _ToDur,
typename _CF,
typename _CR>
232 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
234 template<
typename _Rep,
typename _Period>
235 static constexpr _ToDur
236 __cast(
const duration<_Rep, _Period>& __d)
238 typedef typename _ToDur::rep __to_rep;
239 return _ToDur(static_cast<__to_rep>(
240 static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
244 template<
typename _Tp>
249 template<
typename _Rep,
typename _Period>
250 struct __is_duration<duration<_Rep, _Period>>
254 template<
typename _Tp>
255 using __enable_if_is_duration
256 =
typename enable_if<__is_duration<_Tp>::value, _Tp>::type;
258 template<
typename _Tp>
259 using __disable_if_is_duration
260 =
typename enable_if<!__is_duration<_Tp>::value, _Tp>::type;
265 template<
typename _ToDur,
typename _Rep,
typename _Period>
266 constexpr __enable_if_is_duration<_ToDur>
269 typedef typename _ToDur::period __to_period;
270 typedef typename _ToDur::rep __to_rep;
274 typedef __duration_cast_impl<_ToDur, __cf, __cr,
275 __cf::num == 1, __cf::den == 1> __dc;
276 return __dc::__cast(__d);
280 template<
typename _Rep>
285 #if __cplusplus > 201402L
286 template <
typename _Rep>
287 inline constexpr
bool treat_as_floating_point_v =
291 #if __cplusplus > 201703L
292 template<
typename _Tp>
295 template<
typename _Tp>
296 inline constexpr
bool is_clock_v = is_clock<_Tp>::value;
298 #if __cpp_lib_concepts
299 template<
typename _Tp>
303 template<
typename _Tp>
306 typename _Tp::period;
307 typename _Tp::duration;
308 typename _Tp::time_point::clock;
309 typename _Tp::time_point::duration;
310 { &_Tp::is_steady } -> same_as<const bool*>;
311 { _Tp::now() } -> same_as<typename _Tp::time_point>;
312 requires same_as<
typename _Tp::duration,
313 duration<typename _Tp::rep, typename _Tp::period>>;
314 requires same_as<
typename _Tp::time_point::duration,
315 typename _Tp::duration>;
320 template<
typename _Tp,
typename =
void>
324 template<
typename _Tp>
325 struct __is_clock_impl<_Tp,
326 void_t<typename _Tp::rep, typename _Tp::period,
327 typename _Tp::duration,
328 typename _Tp::time_point::duration,
329 decltype(_Tp::is_steady),
330 decltype(_Tp::now())>>
331 : __and_<is_same<typename _Tp::duration,
332 duration<typename _Tp::rep, typename _Tp::period>>,
333 is_same<typename _Tp::time_point::duration,
334 typename _Tp::duration>,
335 is_same<decltype(&_Tp::is_steady), const bool*>,
336 is_same<decltype(_Tp::now()), typename _Tp::time_point>>::type
339 template<
typename _Tp>
340 struct is_clock : __is_clock_impl<_Tp>::type
345 #if __cplusplus >= 201703L
346 # define __cpp_lib_chrono 201611
348 template<
typename _ToDur,
typename _Rep,
typename _Period>
349 constexpr __enable_if_is_duration<_ToDur>
350 floor(
const duration<_Rep, _Period>& __d)
354 return __to - _ToDur{1};
358 template<
typename _ToDur,
typename _Rep,
typename _Period>
359 constexpr __enable_if_is_duration<_ToDur>
360 ceil(
const duration<_Rep, _Period>& __d)
364 return __to + _ToDur{1};
368 template <
typename _ToDur,
typename _Rep,
typename _Period>
370 __and_<__is_duration<_ToDur>,
371 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
373 round(
const duration<_Rep, _Period>& __d)
375 _ToDur __t0 = chrono::floor<_ToDur>(__d);
376 _ToDur __t1 = __t0 + _ToDur{1};
377 auto __diff0 = __d - __t0;
378 auto __diff1 = __t1 - __d;
379 if (__diff0 == __diff1)
381 if (__t0.count() & 1)
385 else if (__diff0 < __diff1)
390 template<
typename _Rep,
typename _Period>
392 enable_if_t<numeric_limits<_Rep>::is_signed, duration<_Rep, _Period>>
393 abs(duration<_Rep, _Period> __d)
395 if (__d >= __d.zero())
401 namespace __detail {
using chrono::ceil; }
410 template<
typename _Tp,
typename _Up>
412 __ceil_impl(
const _Tp& __t,
const _Up& __u)
414 return (__t < __u) ? (__t + _Tp{1}) : __t;
418 template<
typename _ToDur,
typename _Rep,
typename _Period>
420 ceil(
const duration<_Rep, _Period>& __d)
422 return __detail::__ceil_impl(chrono::duration_cast<_ToDur>(__d), __d);
428 template<
typename _Rep>
431 static constexpr _Rep
435 static constexpr _Rep
439 static constexpr _Rep
446 template<
typename _Tp>
451 template<
intmax_t _Num,
intmax_t _Den>
452 struct __is_ratio<
ratio<_Num, _Den>>
458 template<
typename _Rep,
typename _Period>
462 template<
typename _Rep2>
463 using __is_float = treat_as_floating_point<_Rep2>;
465 static constexpr intmax_t
466 _S_gcd(intmax_t __m, intmax_t __n) noexcept
470 #if __cplusplus >= 201402L
473 intmax_t __rem = __m % __n;
482 return (__n == 0) ? __m : _S_gcd(__n, __m % __n);
490 template<
typename _R1,
typename _R2,
491 intmax_t __gcd1 = _S_gcd(_R1::num, _R2::num),
492 intmax_t __gcd2 = _S_gcd(_R1::den, _R2::den)>
493 using __divide = ratio<(_R1::num / __gcd1) * (_R2::den / __gcd2),
494 (_R1::den / __gcd2) * (_R2::num / __gcd1)>;
497 template<
typename _Period2>
499 = __bool_constant<__divide<_Period2, _Period>::den == 1>;
504 using period =
typename _Period::type;
506 static_assert(!__is_duration<_Rep>::value,
"rep cannot be a duration");
507 static_assert(__is_ratio<_Period>::value,
508 "period must be a specialization of ratio");
509 static_assert(_Period::num > 0,
"period must be positive");
512 constexpr duration() =
default;
514 duration(
const duration&) =
default;
518 template<
typename _Rep2,
typename = _Require<
519 is_convertible<const _Rep2&, rep>,
520 __or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>>
521 constexpr
explicit duration(
const _Rep2& __rep)
522 : __r(static_cast<rep>(__rep)) { }
524 template<
typename _Rep2,
typename _Period2,
typename = _Require<
525 is_convertible<const _Rep2&, rep>,
526 __or_<__is_float<rep>,
527 __and_<__is_harmonic<_Period2>,
528 __not_<__is_float<_Rep2>>>>>>
529 constexpr duration(
const duration<_Rep2, _Period2>& __d)
532 ~duration() =
default;
533 duration& operator=(
const duration&) =
default;
542 constexpr duration<typename common_type<rep>::type, period>
544 {
return duration<typename common_type<rep>::type, period>(__r); }
546 constexpr duration<typename common_type<rep>::type, period>
548 {
return duration<typename common_type<rep>::type, period>(-__r); }
550 _GLIBCXX17_CONSTEXPR duration&
557 _GLIBCXX17_CONSTEXPR duration
559 {
return duration(__r++); }
561 _GLIBCXX17_CONSTEXPR duration&
568 _GLIBCXX17_CONSTEXPR duration
570 {
return duration(__r--); }
572 _GLIBCXX17_CONSTEXPR duration&
573 operator+=(
const duration& __d)
579 _GLIBCXX17_CONSTEXPR duration&
580 operator-=(
const duration& __d)
586 _GLIBCXX17_CONSTEXPR duration&
587 operator*=(
const rep& __rhs)
593 _GLIBCXX17_CONSTEXPR duration&
594 operator/=(
const rep& __rhs)
601 template<
typename _Rep2 = rep>
603 typename enable_if<!treat_as_floating_point<_Rep2>::value,
605 operator%=(
const rep& __rhs)
611 template<
typename _Rep2 = rep>
613 typename enable_if<!treat_as_floating_point<_Rep2>::value,
615 operator%=(
const duration& __d)
622 static constexpr duration
624 {
return duration(duration_values<rep>::zero()); }
626 static constexpr duration
630 static constexpr duration
642 template<
typename _Rep1,
typename _Period1,
643 typename _Rep2,
typename _Period2>
644 constexpr
typename common_type<duration<_Rep1, _Period1>,
645 duration<_Rep2, _Period2>>::type
652 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
656 template<
typename _Rep1,
typename _Period1,
657 typename _Rep2,
typename _Period2>
666 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
677 template<
typename _Rep1,
typename _Rep2,
679 using __common_rep_t =
typename
689 template<
typename _Rep1,
typename _Period,
typename _Rep2>
690 constexpr duration<__common_rep_t<_Rep1, _Rep2>, _Period>
695 return __cd(__cd(__d).count() * __s);
698 template<
typename _Rep1,
typename _Rep2,
typename _Period>
701 {
return __d * __s; }
703 template<
typename _Rep1,
typename _Period,
typename _Rep2>
705 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
710 return __cd(__cd(__d).count() / __s);
713 template<
typename _Rep1,
typename _Period1,
714 typename _Rep2,
typename _Period2>
722 return __cd(__lhs).count() / __cd(__rhs).count();
726 template<
typename _Rep1,
typename _Period,
typename _Rep2>
728 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
733 return __cd(__cd(__d).count() % __s);
736 template<
typename _Rep1,
typename _Period1,
737 typename _Rep2,
typename _Period2>
739 duration<_Rep2, _Period2>>::type
746 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
757 template<
typename _Rep1,
typename _Period1,
758 typename _Rep2,
typename _Period2>
766 return __ct(__lhs).count() == __ct(__rhs).count();
769 template<
typename _Rep1,
typename _Period1,
770 typename _Rep2,
typename _Period2>
772 operator<(const duration<_Rep1, _Period1>& __lhs,
778 return __ct(__lhs).count() < __ct(__rhs).count();
781 #if __cpp_lib_three_way_comparison
782 template<
typename _Rep1,
typename _Period1,
783 typename _Rep2,
typename _Period2>
784 requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
786 operator<=>(
const duration<_Rep1, _Period1>& __lhs,
787 const duration<_Rep2, _Period2>& __rhs)
790 duration<_Rep2, _Period2>>;
791 return __ct(__lhs).count() <=> __ct(__rhs).count();
794 template<
typename _Rep1,
typename _Period1,
795 typename _Rep2,
typename _Period2>
798 const duration<_Rep2, _Period2>& __rhs)
799 {
return !(__lhs == __rhs); }
802 template<
typename _Rep1,
typename _Period1,
803 typename _Rep2,
typename _Period2>
805 operator<=(const duration<_Rep1, _Period1>& __lhs,
806 const duration<_Rep2, _Period2>& __rhs)
807 {
return !(__rhs < __lhs); }
809 template<
typename _Rep1,
typename _Period1,
810 typename _Rep2,
typename _Period2>
813 const duration<_Rep2, _Period2>& __rhs)
814 {
return __rhs < __lhs; }
816 template<
typename _Rep1,
typename _Period1,
817 typename _Rep2,
typename _Period2>
820 const duration<_Rep2, _Period2>& __rhs)
821 {
return !(__lhs < __rhs); }
826 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
827 # define _GLIBCXX_CHRONO_INT64_T int64_t
828 #elif defined __INT64_TYPE__
829 # define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__
832 "Representation type for nanoseconds must have at least 64 bits");
833 # define _GLIBCXX_CHRONO_INT64_T long long
855 #if __cplusplus > 201703L
869 #undef _GLIBCXX_CHRONO_INT64_T
871 template<
typename _Clock,
typename _Dur>
874 static_assert(__is_duration<_Dur>::value,
875 "duration must be a specialization of std::chrono::duration");
877 typedef _Clock clock;
879 typedef typename duration::rep rep;
880 typedef typename duration::period period;
882 constexpr
time_point() : __d(duration::zero())
885 constexpr
explicit time_point(
const duration& __dur)
890 template<
typename _Dur2,
891 typename = _Require<is_convertible<_Dur2, _Dur>>>
893 : __d(__t.time_since_epoch())
898 time_since_epoch()
const
901 #if __cplusplus > 201703L
902 constexpr time_point&
911 {
return time_point{__d++}; }
913 constexpr time_point&
922 {
return time_point{__d--}; }
926 _GLIBCXX17_CONSTEXPR time_point&
933 _GLIBCXX17_CONSTEXPR time_point&
941 static constexpr time_point
943 {
return time_point(duration::min()); }
945 static constexpr time_point
947 {
return time_point(duration::max()); }
954 template<
typename _ToDur,
typename _Clock,
typename _Dur>
956 time_point<_Clock, _ToDur>>::type
960 return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
963 #if __cplusplus > 201402L
964 template<
typename _ToDur,
typename _Clock,
typename _Dur>
967 floor(
const time_point<_Clock, _Dur>& __tp)
969 return time_point<_Clock, _ToDur>{
970 chrono::floor<_ToDur>(__tp.time_since_epoch())};
973 template<
typename _ToDur,
typename _Clock,
typename _Dur>
975 enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
976 ceil(
const time_point<_Clock, _Dur>& __tp)
978 return time_point<_Clock, _ToDur>{
979 chrono::ceil<_ToDur>(__tp.time_since_epoch())};
982 template<
typename _ToDur,
typename _Clock,
typename _Dur>
984 __and_<__is_duration<_ToDur>,
985 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
986 time_point<_Clock, _ToDur>>
987 round(
const time_point<_Clock, _Dur>& __tp)
989 return time_point<_Clock, _ToDur>{
990 chrono::round<_ToDur>(__tp.time_since_epoch())};
998 template<
typename _Clock,
typename _Dur1,
999 typename _Rep2,
typename _Period2>
1000 constexpr time_point<_Clock,
1001 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
1003 const duration<_Rep2, _Period2>& __rhs)
1005 typedef duration<_Rep2, _Period2> __dur2;
1008 return __time_point(__lhs.time_since_epoch() + __rhs);
1012 template<
typename _Rep1,
typename _Period1,
1013 typename _Clock,
typename _Dur2>
1022 return __time_point(__rhs.time_since_epoch() + __lhs);
1026 template<
typename _Clock,
typename _Dur1,
1027 typename _Rep2,
typename _Period2>
1028 constexpr time_point<_Clock,
1031 const duration<_Rep2, _Period2>& __rhs)
1033 typedef duration<_Rep2, _Period2> __dur2;
1036 return __time_point(__lhs.time_since_epoch() -__rhs);
1040 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1044 {
return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
1052 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1054 operator==(
const time_point<_Clock, _Dur1>& __lhs,
1055 const time_point<_Clock, _Dur2>& __rhs)
1056 {
return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
1058 #if __cpp_lib_three_way_comparison
1059 template<
typename _Clock,
typename _Dur1,
1060 three_way_comparable_with<_Dur1> _Dur2>
1062 operator<=>(
const time_point<_Clock, _Dur1>& __lhs,
1063 const time_point<_Clock, _Dur2>& __rhs)
1064 {
return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); }
1066 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1068 operator!=(
const time_point<_Clock, _Dur1>& __lhs,
1069 const time_point<_Clock, _Dur2>& __rhs)
1070 {
return !(__lhs == __rhs); }
1073 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1075 operator<(const time_point<_Clock, _Dur1>& __lhs,
1076 const time_point<_Clock, _Dur2>& __rhs)
1077 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
1079 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1081 operator<=(const time_point<_Clock, _Dur1>& __lhs,
1082 const time_point<_Clock, _Dur2>& __rhs)
1083 {
return !(__rhs < __lhs); }
1085 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1087 operator>(
const time_point<_Clock, _Dur1>& __lhs,
1088 const time_point<_Clock, _Dur2>& __rhs)
1089 {
return __rhs < __lhs; }
1091 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1093 operator>=(
const time_point<_Clock, _Dur1>& __lhs,
1094 const time_point<_Clock, _Dur2>& __rhs)
1095 {
return !(__lhs < __rhs); }
1117 inline namespace _V2 {
1128 typedef duration::rep rep;
1129 typedef duration::period period;
1132 static_assert(system_clock::duration::min()
1133 < system_clock::duration::zero(),
1134 "a clock's minimum duration cannot be less than its epoch");
1136 static constexpr
bool is_steady =
false;
1145 return std::time_t(duration_cast<chrono::seconds>
1146 (__t.time_since_epoch()).count());
1150 from_time_t(std::time_t __t) noexcept
1168 typedef duration::rep rep;
1169 typedef duration::period period;
1172 static constexpr
bool is_steady =
true;
1191 #if __cplusplus > 201703L
1192 template<
typename _Duration>
1194 using sys_seconds = sys_time<seconds>;
1195 using sys_days = sys_time<days>;
1197 using file_clock = ::std::filesystem::__file_clock;
1199 template<
typename _Duration>
1202 template<>
struct is_clock<system_clock> :
true_type { };
1203 template<>
struct is_clock<steady_clock> :
true_type { };
1204 template<>
struct is_clock<file_clock> :
true_type { };
1206 template<>
inline constexpr
bool is_clock_v<system_clock> =
true;
1207 template<>
inline constexpr
bool is_clock_v<steady_clock> =
true;
1208 template<>
inline constexpr
bool is_clock_v<file_clock> =
true;
1211 template<
typename _Duration>
1212 using local_time = time_point<local_t, _Duration>;
1213 using local_seconds = local_time<seconds>;
1214 using local_days = local_time<days>;
1220 template<
typename _Duration>
1221 using utc_time = time_point<utc_clock, _Duration>;
1222 using utc_seconds = utc_time<seconds>;
1224 template<
typename _Duration>
1225 using tai_time = time_point<tai_clock, _Duration>;
1226 using tai_seconds = tai_time<seconds>;
1228 template<
typename _Duration>
1229 using gps_time = time_point<gps_clock, _Duration>;
1230 using gps_seconds = gps_time<seconds>;
1232 template<>
struct is_clock<utc_clock> :
true_type { };
1233 template<>
struct is_clock<tai_clock> :
true_type { };
1234 template<>
struct is_clock<gps_clock> :
true_type { };
1236 template<>
inline constexpr
bool is_clock_v<utc_clock> =
true;
1237 template<>
inline constexpr
bool is_clock_v<tai_clock> =
true;
1238 template<>
inline constexpr
bool is_clock_v<gps_clock> =
true;
1240 struct leap_second_info
1242 bool is_leap_second;
1253 class weekday_indexed;
1256 class month_day_last;
1257 class month_weekday;
1258 class month_weekday_last;
1260 class year_month_day;
1261 class year_month_day_last;
1262 class year_month_weekday;
1263 class year_month_weekday_last;
1267 explicit last_spec() =
default;
1269 friend constexpr month_day_last
1272 friend constexpr month_day_last
1273 operator/(last_spec,
int __m) noexcept;
1276 inline constexpr last_spec last{};
1286 __modulo(
long long __n,
unsigned __d)
1291 return (__d + (__n % __d)) % __d;
1294 inline constexpr
unsigned __days_per_month[12]
1295 = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
1309 day(
unsigned __d) noexcept
1314 operator++() noexcept
1321 operator++(
int) noexcept
1329 operator--() noexcept
1336 operator--(
int) noexcept
1344 operator+=(
const days& __d) noexcept
1346 *
this = *
this + __d;
1351 operator-=(
const days& __d) noexcept
1353 *
this = *
this - __d;
1358 operator unsigned() const noexcept
1363 {
return 1 <= _M_d && _M_d <= 31; }
1365 friend constexpr
bool
1366 operator==(
const day& __x,
const day& __y) noexcept
1367 {
return unsigned{__x} ==
unsigned{__y}; }
1369 friend constexpr strong_ordering
1370 operator<=>(
const day& __x,
const day& __y) noexcept
1371 {
return unsigned{__x} <=>
unsigned{__y}; }
1373 friend constexpr day
1374 operator+(
const day& __x,
const days& __y) noexcept
1375 {
return day(
unsigned{__x} + __y.count()); }
1377 friend constexpr day
1378 operator+(
const days& __x,
const day& __y) noexcept
1379 {
return __y + __x; }
1381 friend constexpr day
1382 operator-(
const day& __x,
const days& __y) noexcept
1383 {
return __x + -__y; }
1385 friend constexpr days
1386 operator-(
const day& __x,
const day& __y) noexcept
1387 {
return days{int(
unsigned{__x}) -
int(
unsigned{__y})}; }
1389 friend constexpr month_day
1390 operator/(
const month& __m,
const day& __d) noexcept;
1392 friend constexpr month_day
1393 operator/(
int __m,
const day& __d) noexcept;
1395 friend constexpr month_day
1396 operator/(
const day& __d,
const month& __m) noexcept;
1398 friend constexpr month_day
1399 operator/(
const day& __d,
int __m) noexcept;
1401 friend constexpr year_month_day
1402 operator/(
const year_month& __ym,
const day& __d) noexcept;
1418 month(
unsigned __m) noexcept
1423 operator++() noexcept
1430 operator++(
int) noexcept
1438 operator--() noexcept
1445 operator--(
int) noexcept
1453 operator+=(
const months& __m) noexcept
1455 *
this = *
this + __m;
1460 operator-=(
const months& __m) noexcept
1462 *
this = *
this - __m;
1467 operator unsigned() const noexcept
1472 {
return 1 <= _M_m && _M_m <= 12; }
1474 friend constexpr
bool
1475 operator==(
const month& __x,
const month& __y) noexcept
1476 {
return unsigned{__x} ==
unsigned{__y}; }
1478 friend constexpr strong_ordering
1479 operator<=>(
const month& __x,
const month& __y) noexcept
1480 {
return unsigned{__x} <=>
unsigned{__y}; }
1482 friend constexpr month
1483 operator+(
const month& __x,
const months& __y) noexcept
1485 auto __n =
static_cast<long long>(
unsigned{__x}) + (__y.count() - 1);
1486 return month{__detail::__modulo(__n, 12) + 1};
1489 friend constexpr month
1490 operator+(
const months& __x,
const month& __y) noexcept
1491 {
return __y + __x; }
1493 friend constexpr month
1494 operator-(
const month& __x,
const months& __y) noexcept
1495 {
return __x + -__y; }
1497 friend constexpr months
1498 operator-(
const month& __x,
const month& __y) noexcept
1500 const auto __dm = int(
unsigned(__x)) - int(
unsigned(__y));
1501 return months{__dm < 0 ? 12 + __dm : __dm};
1504 friend constexpr year_month
1505 operator/(
const year& __y,
const month& __m) noexcept;
1507 friend constexpr month_day
1508 operator/(
const month& __m,
int __d) noexcept;
1510 friend constexpr month_day_last
1511 operator/(
const month& __m, last_spec) noexcept;
1513 friend constexpr month_day_last
1514 operator/(last_spec, const month& __m) noexcept;
1516 friend constexpr month_weekday
1517 operator/(const month& __m, const weekday_indexed& __wdi) noexcept;
1519 friend constexpr month_weekday
1520 operator/(const weekday_indexed& __wdi, const month& __m) noexcept;
1522 friend constexpr month_weekday_last
1523 operator/(const month& __m, const weekday_last& __wdl) noexcept;
1525 friend constexpr month_weekday_last
1526 operator/(const weekday_last& __wdl, const month& __m) noexcept;
1531 inline constexpr month January{1};
1532 inline constexpr month February{2};
1533 inline constexpr month March{3};
1534 inline constexpr month April{4};
1535 inline constexpr month May{5};
1536 inline constexpr month June{6};
1537 inline constexpr month July{7};
1538 inline constexpr month August{8};
1539 inline constexpr month September{9};
1540 inline constexpr month October{10};
1541 inline constexpr month November{11};
1542 inline constexpr month December{12};
1555 year(
int __y) noexcept
1556 : _M_y{
static_cast<short>(__y)}
1559 static constexpr year
1561 {
return year{-32767}; }
1563 static constexpr year
1565 {
return year{32767}; }
1568 operator++() noexcept
1575 operator++(
int) noexcept
1583 operator--() noexcept
1590 operator--(
int) noexcept
1598 operator+=(
const years& __y) noexcept
1600 *
this = *
this + __y;
1605 operator-=(
const years& __y) noexcept
1607 *
this = *
this - __y;
1617 {
return year{-_M_y}; }
1620 is_leap() const noexcept
1633 constexpr uint32_t __multiplier = 42949673;
1634 constexpr uint32_t __bound = 42949669;
1635 constexpr uint32_t __max_dividend = 1073741799;
1636 constexpr uint32_t __offset = __max_dividend / 2 / 100 * 100;
1637 const bool __is_multiple_of_100
1638 = __multiplier * (_M_y + __offset) < __bound;
1639 return (!__is_multiple_of_100 || _M_y % 400 == 0) && _M_y % 4 == 0;
1643 operator int() const noexcept
1648 {
return min()._M_y <= _M_y && _M_y <=
max()._M_y; }
1650 friend constexpr
bool
1651 operator==(
const year& __x,
const year& __y) noexcept
1652 {
return int{__x} ==
int{__y}; }
1654 friend constexpr strong_ordering
1655 operator<=>(
const year& __x,
const year& __y) noexcept
1656 {
return int{__x} <=>
int{__y}; }
1658 friend constexpr year
1659 operator+(
const year& __x,
const years& __y) noexcept
1660 {
return year{
int{__x} +
static_cast<int>(__y.count())}; }
1662 friend constexpr year
1663 operator+(
const years& __x,
const year& __y) noexcept
1664 {
return __y + __x; }
1666 friend constexpr year
1667 operator-(
const year& __x,
const years& __y) noexcept
1668 {
return __x + -__y; }
1670 friend constexpr years
1671 operator-(
const year& __x,
const year& __y) noexcept
1672 {
return years{
int{__x} -
int{__y}}; }
1674 friend constexpr year_month
1675 operator/(
const year& __y,
int __m) noexcept;
1677 friend constexpr year_month_day
1678 operator/(
const year& __y,
const month_day& __md) noexcept;
1680 friend constexpr year_month_day
1681 operator/(
const month_day& __md,
const year& __y) noexcept;
1683 friend constexpr year_month_day_last
1684 operator/(
const year& __y,
const month_day_last& __mdl) noexcept;
1686 friend constexpr year_month_day_last
1687 operator/(
const month_day_last& __mdl,
const year& __y) noexcept;
1689 friend constexpr year_month_weekday
1690 operator/(
const year& __y,
const month_weekday& __mwd) noexcept;
1692 friend constexpr year_month_weekday
1693 operator/(
const month_weekday& __mwd,
const year& __y) noexcept;
1695 friend constexpr year_month_weekday_last
1696 operator/(
const year& __y,
const month_weekday_last& __mwdl) noexcept;
1698 friend constexpr year_month_weekday_last
1699 operator/(
const month_weekday_last& __mwdl,
const year& __y) noexcept;
1709 unsigned char _M_wd;
1711 static constexpr weekday
1712 _S_from_days(
const days& __d)
1714 auto __n = __d.count();
1715 return weekday(__n >= -4 ? (__n + 4) % 7 : (__n + 5) % 7 + 6);
1719 weekday() =
default;
1722 weekday(
unsigned __wd) noexcept
1723 : _M_wd(__wd == 7 ? 0 : __wd)
1727 weekday(
const sys_days& __dp) noexcept
1728 : weekday{_S_from_days(__dp.time_since_epoch())}
1732 weekday(
const local_days& __dp) noexcept
1733 : weekday{sys_days{__dp.time_since_epoch()}}
1737 operator++() noexcept
1744 operator++(
int) noexcept
1752 operator--() noexcept
1759 operator--(
int) noexcept
1767 operator+=(
const days& __d) noexcept
1769 *
this = *
this + __d;
1774 operator-=(
const days& __d) noexcept
1776 *
this = *
this - __d;
1781 c_encoding() const noexcept
1785 iso_encoding() const noexcept
1786 {
return _M_wd == 0u ? 7u : _M_wd; }
1790 {
return _M_wd <= 6; }
1792 constexpr weekday_indexed
1793 operator[](
unsigned __index)
const noexcept;
1795 constexpr weekday_last
1796 operator[](last_spec) const noexcept;
1798 friend constexpr
bool
1799 operator==(const weekday& __x, const weekday& __y) noexcept
1800 {
return __x._M_wd == __y._M_wd; }
1802 friend constexpr weekday
1803 operator+(
const weekday& __x,
const days& __y) noexcept
1805 auto __n =
static_cast<long long>(__x._M_wd) + __y.count();
1806 return weekday{__detail::__modulo(__n, 7)};
1809 friend constexpr weekday
1810 operator+(
const days& __x,
const weekday& __y) noexcept
1811 {
return __y + __x; }
1813 friend constexpr weekday
1814 operator-(
const weekday& __x,
const days& __y) noexcept
1815 {
return __x + -__y; }
1817 friend constexpr days
1818 operator-(
const weekday& __x,
const weekday& __y) noexcept
1820 auto __n =
static_cast<long long>(__x._M_wd) - __y._M_wd;
1821 return days{__detail::__modulo(__n, 7)};
1827 inline constexpr weekday Sunday{0};
1828 inline constexpr weekday Monday{1};
1829 inline constexpr weekday Tuesday{2};
1830 inline constexpr weekday Wednesday{3};
1831 inline constexpr weekday Thursday{4};
1832 inline constexpr weekday Friday{5};
1833 inline constexpr weekday Saturday{6};
1837 class weekday_indexed
1840 chrono::weekday _M_wd;
1841 unsigned char _M_index;
1844 weekday_indexed() =
default;
1847 weekday_indexed(
const chrono::weekday& __wd,
unsigned __index) noexcept
1848 : _M_wd(__wd), _M_index(__index)
1851 constexpr chrono::weekday
1852 weekday() const noexcept
1856 index() const noexcept
1857 {
return _M_index; };
1861 {
return _M_wd.ok() && 1 <= _M_index && _M_index <= 5; }
1863 friend constexpr
bool
1864 operator==(
const weekday_indexed& __x,
const weekday_indexed& __y) noexcept
1865 {
return __x.weekday() == __y.weekday() && __x.index() == __y.index(); }
1867 friend constexpr month_weekday
1868 operator/(
const month& __m,
const weekday_indexed& __wdi) noexcept;
1870 friend constexpr month_weekday
1871 operator/(
int __m,
const weekday_indexed& __wdi) noexcept;
1873 friend constexpr month_weekday
1874 operator/(
const weekday_indexed& __wdi,
const month& __m) noexcept;
1876 friend constexpr month_weekday
1877 operator/(
const weekday_indexed& __wdi,
int __m) noexcept;
1879 friend constexpr year_month_weekday
1880 operator/(
const year_month& __ym,
const weekday_indexed& __wdi) noexcept;
1885 constexpr weekday_indexed
1886 weekday::operator[](
unsigned __index)
const noexcept
1887 {
return {*
this, __index}; }
1894 chrono::weekday _M_wd;
1898 weekday_last(
const chrono::weekday& __wd) noexcept
1902 constexpr chrono::weekday
1903 weekday() const noexcept
1908 {
return _M_wd.ok(); }
1910 friend constexpr
bool
1911 operator==(
const weekday_last& __x,
const weekday_last& __y) noexcept
1912 {
return __x.weekday() == __y.weekday(); }
1914 friend constexpr month_weekday_last
1915 operator/(
int __m,
const weekday_last& __wdl) noexcept;
1917 friend constexpr month_weekday_last
1918 operator/(
const weekday_last& __wdl,
int __m) noexcept;
1920 friend constexpr year_month_weekday_last
1921 operator/(
const year_month& __ym,
const weekday_last& __wdl) noexcept;
1926 constexpr weekday_last
1927 weekday::operator[](last_spec) const noexcept
1928 {
return weekday_last{*
this}; }
1939 month_day() =
default;
1942 month_day(
const chrono::month& __m,
const chrono::day& __d) noexcept
1943 : _M_m{__m}, _M_d{__d}
1946 constexpr chrono::month
1947 month() const noexcept
1950 constexpr chrono::day
1951 day() const noexcept
1958 && 1u <= unsigned(_M_d)
1959 && unsigned(_M_d) <= __detail::__days_per_month[unsigned(_M_m) - 1];
1962 friend constexpr
bool
1963 operator==(
const month_day& __x,
const month_day& __y) noexcept
1964 {
return __x.month() == __y.month() && __x.day() == __y.day(); }
1966 friend constexpr strong_ordering
1967 operator<=>(
const month_day& __x,
const month_day& __y) noexcept
1970 friend constexpr month_day
1971 operator/(
const chrono::month& __m,
const chrono::day& __d) noexcept
1972 {
return {__m, __d}; }
1974 friend constexpr month_day
1975 operator/(
const chrono::month& __m,
int __d) noexcept
1976 {
return {__m, chrono::day(
unsigned(__d))}; }
1978 friend constexpr month_day
1979 operator/(
int __m,
const chrono::day& __d) noexcept
1980 {
return {chrono::month(
unsigned(__m)), __d}; }
1982 friend constexpr month_day
1983 operator/(
const chrono::day& __d,
const chrono::month& __m) noexcept
1984 {
return {__m, __d}; }
1986 friend constexpr month_day
1987 operator/(
const chrono::day& __d,
int __m) noexcept
1988 {
return {chrono::month(
unsigned(__m)), __d}; }
1990 friend constexpr year_month_day
1991 operator/(
int __y,
const month_day& __md) noexcept;
1993 friend constexpr year_month_day
1994 operator/(
const month_day& __md,
int __y) noexcept;
2001 class month_day_last
2008 month_day_last(
const chrono::month& __m) noexcept
2012 constexpr chrono::month
2013 month() const noexcept
2018 {
return _M_m.ok(); }
2020 friend constexpr
bool
2021 operator==(
const month_day_last& __x,
const month_day_last& __y) noexcept
2022 {
return __x.month() == __y.month(); }
2024 friend constexpr strong_ordering
2025 operator<=>(
const month_day_last& __x,
const month_day_last& __y) noexcept
2028 friend constexpr month_day_last
2029 operator/(
const chrono::month& __m, last_spec) noexcept
2030 {
return month_day_last{__m}; }
2032 friend constexpr month_day_last
2034 {
return chrono::month(
unsigned(__m)) / last; }
2036 friend constexpr month_day_last
2037 operator/(last_spec,
const chrono::month& __m) noexcept
2038 {
return __m / last; }
2040 friend constexpr month_day_last
2042 {
return __m / last; }
2044 friend constexpr year_month_day_last
2045 operator/(
int __y,
const month_day_last& __mdl) noexcept;
2047 friend constexpr year_month_day_last
2048 operator/(
const month_day_last& __mdl,
int __y) noexcept;
2059 chrono::weekday_indexed _M_wdi;
2063 month_weekday(
const chrono::month& __m,
2064 const chrono::weekday_indexed& __wdi) noexcept
2065 : _M_m{__m}, _M_wdi{__wdi}
2068 constexpr chrono::month
2069 month() const noexcept
2072 constexpr chrono::weekday_indexed
2073 weekday_indexed() const noexcept
2078 {
return _M_m.ok() && _M_wdi.ok(); }
2080 friend constexpr
bool
2081 operator==(
const month_weekday& __x,
const month_weekday& __y) noexcept
2083 return __x.month() == __y.month()
2084 && __x.weekday_indexed() == __y.weekday_indexed();
2087 friend constexpr month_weekday
2089 const chrono::weekday_indexed& __wdi) noexcept
2090 {
return {__m, __wdi}; }
2092 friend constexpr month_weekday
2093 operator/(
int __m,
const chrono::weekday_indexed& __wdi) noexcept
2094 {
return chrono::month(
unsigned(__m)) / __wdi; }
2096 friend constexpr month_weekday
2097 operator/(
const chrono::weekday_indexed& __wdi,
2098 const chrono::month& __m) noexcept
2099 {
return __m / __wdi; }
2101 friend constexpr month_weekday
2102 operator/(
const chrono::weekday_indexed& __wdi,
int __m) noexcept
2103 {
return __m / __wdi; }
2105 friend constexpr year_month_weekday
2106 operator/(
int __y,
const month_weekday& __mwd) noexcept;
2108 friend constexpr year_month_weekday
2109 operator/(
const month_weekday& __mwd,
int __y) noexcept;
2116 class month_weekday_last
2120 chrono::weekday_last _M_wdl;
2124 month_weekday_last(
const chrono::month& __m,
2125 const chrono::weekday_last& __wdl) noexcept
2126 :_M_m{__m}, _M_wdl{__wdl}
2129 constexpr chrono::month
2130 month() const noexcept
2133 constexpr chrono::weekday_last
2134 weekday_last() const noexcept
2139 {
return _M_m.ok() && _M_wdl.ok(); }
2141 friend constexpr
bool
2142 operator==(
const month_weekday_last& __x,
2143 const month_weekday_last& __y) noexcept
2145 return __x.month() == __y.month()
2146 && __x.weekday_last() == __y.weekday_last();
2149 friend constexpr month_weekday_last
2151 const chrono::weekday_last& __wdl) noexcept
2152 {
return {__m, __wdl}; }
2154 friend constexpr month_weekday_last
2155 operator/(
int __m,
const chrono::weekday_last& __wdl) noexcept
2156 {
return chrono::month(
unsigned(__m)) / __wdl; }
2158 friend constexpr month_weekday_last
2159 operator/(
const chrono::weekday_last& __wdl,
2160 const chrono::month& __m) noexcept
2161 {
return __m / __wdl; }
2163 friend constexpr month_weekday_last
2164 operator/(
const chrono::weekday_last& __wdl,
int __m) noexcept
2165 {
return chrono::month(
unsigned(__m)) / __wdl; }
2167 friend constexpr year_month_weekday_last
2168 operator/(
int __y,
const month_weekday_last& __mwdl) noexcept;
2170 friend constexpr year_month_weekday_last
2171 operator/(
const month_weekday_last& __mwdl,
int __y) noexcept;
2192 using __months_years_conversion_disambiguator = void;
2202 year_month() =
default;
2205 year_month(
const chrono::year& __y,
const chrono::month& __m) noexcept
2206 : _M_y{__y}, _M_m{__m}
2209 constexpr chrono::year
2210 year() const noexcept
2213 constexpr chrono::month
2214 month() const noexcept
2217 template<
typename = __detail::__months_years_conversion_disambiguator>
2218 constexpr year_month&
2219 operator+=(
const months& __dm) noexcept
2221 *
this = *
this + __dm;
2225 template<
typename = __detail::__months_years_conversion_disambiguator>
2226 constexpr year_month&
2227 operator-=(
const months& __dm) noexcept
2229 *
this = *
this - __dm;
2233 constexpr year_month&
2234 operator+=(
const years& __dy) noexcept
2236 *
this = *
this + __dy;
2240 constexpr year_month&
2241 operator-=(
const years& __dy) noexcept
2243 *
this = *
this - __dy;
2249 {
return _M_y.ok() && _M_m.ok(); }
2251 friend constexpr
bool
2252 operator==(
const year_month& __x,
const year_month& __y) noexcept
2253 {
return __x.year() == __y.year() && __x.month() == __y.month(); }
2255 friend constexpr strong_ordering
2256 operator<=>(
const year_month& __x,
const year_month& __y) noexcept
2259 template<
typename = __detail::__months_years_conversion_disambiguator>
2260 friend constexpr year_month
2261 operator+(
const year_month& __ym,
const months& __dm) noexcept
2264 auto __m = __ym.month() + __dm;
2265 auto __i = int(
unsigned(__ym.month())) - 1 + __dm.count();
2267 ? __ym.year() + years{(__i - 11) / 12}
2268 : __ym.year() + years{__i / 12});
2272 template<
typename = __detail::__months_years_conversion_disambiguator>
2273 friend constexpr year_month
2274 operator+(
const months& __dm,
const year_month& __ym) noexcept
2275 {
return __ym + __dm; }
2277 template<
typename = __detail::__months_years_conversion_disambiguator>
2278 friend constexpr year_month
2279 operator-(
const year_month& __ym,
const months& __dm) noexcept
2280 {
return __ym + -__dm; }
2282 friend constexpr months
2283 operator-(
const year_month& __x,
const year_month& __y) noexcept
2285 return (__x.year() - __y.year()
2286 + months{
static_cast<int>(
unsigned{__x.month()})
2287 - static_cast<int>(
unsigned{__y.month()})});
2290 friend constexpr year_month
2291 operator+(
const year_month& __ym,
const years& __dy) noexcept
2292 {
return (__ym.year() + __dy) / __ym.month(); }
2294 friend constexpr year_month
2295 operator+(
const years& __dy,
const year_month& __ym) noexcept
2296 {
return __ym + __dy; }
2298 friend constexpr year_month
2299 operator-(
const year_month& __ym,
const years& __dy) noexcept
2300 {
return __ym + -__dy; }
2302 friend constexpr year_month
2303 operator/(
const chrono::year& __y,
const chrono::month& __m) noexcept
2304 {
return {__y, __m}; }
2306 friend constexpr year_month
2307 operator/(
const chrono::year& __y,
int __m) noexcept
2308 {
return {__y, chrono::month(
unsigned(__m))}; }
2310 friend constexpr year_month_day
2311 operator/(
const year_month& __ym,
int __d) noexcept;
2313 friend constexpr year_month_day_last
2314 operator/(
const year_month& __ym, last_spec) noexcept;
2321 class year_month_day
2328 static constexpr year_month_day _S_from_days(
const days& __dp) noexcept;
2330 constexpr days _M_days_since_epoch() const noexcept;
2333 year_month_day() = default;
2336 year_month_day(const chrono::year& __y, const chrono::month& __m,
2337 const chrono::day& __d) noexcept
2338 : _M_y{__y}, _M_m{__m}, _M_d{__d}
2342 year_month_day(
const year_month_day_last& __ymdl) noexcept;
2345 year_month_day(
const sys_days& __dp) noexcept
2346 : year_month_day(_S_from_days(__dp.time_since_epoch()))
2350 year_month_day(
const local_days& __dp) noexcept
2351 : year_month_day(sys_days{__dp.time_since_epoch()})
2354 template<
typename = __detail::__months_years_conversion_disambiguator>
2355 constexpr year_month_day&
2356 operator+=(
const months& __m) noexcept
2358 *
this = *
this + __m;
2362 template<
typename = __detail::__months_years_conversion_disambiguator>
2363 constexpr year_month_day&
2364 operator-=(
const months& __m) noexcept
2366 *
this = *
this - __m;
2370 constexpr year_month_day&
2371 operator+=(
const years& __y) noexcept
2373 *
this = *
this + __y;
2377 constexpr year_month_day&
2378 operator-=(
const years& __y) noexcept
2380 *
this = *
this - __y;
2384 constexpr chrono::year
2385 year() const noexcept
2388 constexpr chrono::month
2389 month() const noexcept
2392 constexpr chrono::day
2393 day() const noexcept
2397 operator sys_days() const noexcept
2398 {
return sys_days{_M_days_since_epoch()}; }
2401 operator local_days() const noexcept
2402 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2404 constexpr
bool ok() const noexcept;
2406 friend constexpr
bool
2407 operator==(const year_month_day& __x, const year_month_day& __y) noexcept
2409 return __x.year() == __y.year()
2410 && __x.month() == __y.month()
2411 && __x.day() == __y.day();
2414 friend constexpr strong_ordering
2415 operator<=>(
const year_month_day& __x,
const year_month_day& __y) noexcept
2418 template<
typename = __detail::__months_years_conversion_disambiguator>
2419 friend constexpr year_month_day
2420 operator+(
const year_month_day& __ymd,
const months& __dm) noexcept
2421 {
return (__ymd.year() / __ymd.month() + __dm) / __ymd.day(); }
2423 template<
typename = __detail::__months_years_conversion_disambiguator>
2424 friend constexpr year_month_day
2425 operator+(
const months& __dm,
const year_month_day& __ymd) noexcept
2426 {
return __ymd + __dm; }
2428 friend constexpr year_month_day
2429 operator+(
const year_month_day& __ymd,
const years& __dy) noexcept
2430 {
return (__ymd.year() + __dy) / __ymd.month() / __ymd.day(); }
2432 friend constexpr year_month_day
2433 operator+(
const years& __dy,
const year_month_day& __ymd) noexcept
2434 {
return __ymd + __dy; }
2436 template<
typename = __detail::__months_years_conversion_disambiguator>
2437 friend constexpr year_month_day
2438 operator-(
const year_month_day& __ymd,
const months& __dm) noexcept
2439 {
return __ymd + -__dm; }
2441 friend constexpr year_month_day
2442 operator-(
const year_month_day& __ymd,
const years& __dy) noexcept
2443 {
return __ymd + -__dy; }
2445 friend constexpr year_month_day
2446 operator/(
const year_month& __ym,
const chrono::day& __d) noexcept
2447 {
return {__ym.year(), __ym.month(), __d}; }
2449 friend constexpr year_month_day
2450 operator/(
const year_month& __ym,
int __d) noexcept
2451 {
return __ym / chrono::day{unsigned(__d)}; }
2453 friend constexpr year_month_day
2454 operator/(
const chrono::year& __y,
const month_day& __md) noexcept
2455 {
return __y / __md.month() / __md.day(); }
2457 friend constexpr year_month_day
2458 operator/(
int __y,
const month_day& __md) noexcept
2459 {
return chrono::year{__y} / __md; }
2461 friend constexpr year_month_day
2462 operator/(
const month_day& __md,
const chrono::year& __y) noexcept
2463 {
return __y / __md; }
2465 friend constexpr year_month_day
2466 operator/(
const month_day& __md,
int __y) noexcept
2467 {
return chrono::year(__y) / __md; }
2476 constexpr year_month_day
2477 year_month_day::_S_from_days(
const days& __dp) noexcept
2479 constexpr
auto __z2 =
static_cast<uint32_t
>(-1468000);
2480 constexpr
auto __r2_e3 =
static_cast<uint32_t
>(536895458);
2482 const auto __r0 =
static_cast<uint32_t
>(__dp.count()) + __r2_e3;
2484 const auto __n1 = 4 * __r0 + 3;
2485 const auto __q1 = __n1 / 146097;
2486 const auto __r1 = __n1 % 146097 / 4;
2488 constexpr
auto __p32 =
static_cast<uint64_t
>(1) << 32;
2489 const auto __n2 = 4 * __r1 + 3;
2490 const auto __u2 =
static_cast<uint64_t
>(2939745) * __n2;
2491 const auto __q2 =
static_cast<uint32_t
>(__u2 / __p32);
2492 const auto __r2 =
static_cast<uint32_t
>(__u2 % __p32) / 2939745 / 4;
2494 constexpr
auto __p16 =
static_cast<uint32_t
>(1) << 16;
2495 const auto __n3 = 2141 * __r2 + 197913;
2496 const auto __q3 = __n3 / __p16;
2497 const auto __r3 = __n3 % __p16 / 2141;
2499 const auto __y0 = 100 * __q1 + __q2;
2500 const auto __m0 = __q3;
2501 const auto __d0 = __r3;
2503 const auto __j = __r2 >= 306;
2504 const auto __y1 = __y0 + __j;
2505 const auto __m1 = __j ? __m0 - 12 : __m0;
2506 const auto __d1 = __d0 + 1;
2508 return year_month_day{chrono::year{
static_cast<int>(__y1 + __z2)},
2509 chrono::month{__m1}, chrono::day{__d1}};
2517 year_month_day::_M_days_since_epoch() const noexcept
2519 auto constexpr __z2 =
static_cast<uint32_t
>(-1468000);
2520 auto constexpr __r2_e3 =
static_cast<uint32_t
>(536895458);
2522 const auto __y1 =
static_cast<uint32_t
>(
static_cast<int>(_M_y)) - __z2;
2523 const auto __m1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_m));
2524 const auto __d1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_d));
2526 const auto __j =
static_cast<uint32_t
>(__m1 < 3);
2527 const auto __y0 = __y1 - __j;
2528 const auto __m0 = __j ? __m1 + 12 : __m1;
2529 const auto __d0 = __d1 - 1;
2531 const auto __q1 = __y0 / 100;
2532 const auto __yc = 1461 * __y0 / 4 - __q1 + __q1 / 4;
2533 const auto __mc = (979 *__m0 - 2919) / 32;
2534 const auto __dc = __d0;
2536 return days{
static_cast<int32_t
>(__yc + __mc + __dc - __r2_e3)};
2541 class year_month_day_last
2545 chrono::month_day_last _M_mdl;
2549 year_month_day_last(
const chrono::year& __y,
2550 const chrono::month_day_last& __mdl) noexcept
2551 : _M_y{__y}, _M_mdl{__mdl}
2554 template<
typename = __detail::__months_years_conversion_disambiguator>
2555 constexpr year_month_day_last&
2556 operator+=(
const months& __m) noexcept
2558 *
this = *
this + __m;
2562 template<
typename = __detail::__months_years_conversion_disambiguator>
2563 constexpr year_month_day_last&
2564 operator-=(
const months& __m) noexcept
2566 *
this = *
this - __m;
2570 constexpr year_month_day_last&
2571 operator+=(
const years& __y) noexcept
2573 *
this = *
this + __y;
2577 constexpr year_month_day_last&
2578 operator-=(
const years& __y) noexcept
2580 *
this = *
this - __y;
2584 constexpr chrono::year
2585 year() const noexcept
2588 constexpr chrono::month
2589 month() const noexcept
2590 {
return _M_mdl.month(); }
2592 constexpr chrono::month_day_last
2593 month_day_last() const noexcept
2597 constexpr chrono::day
2598 day() const noexcept
2600 const auto __m =
static_cast<unsigned>(month());
2616 return chrono::day{__m != 2 ? ((__m ^ (__m >> 3)) & 1) | 30
2617 : _M_y.is_leap() ? 29 : 28};
2621 operator sys_days() const noexcept
2622 {
return sys_days{year() / month() / day()}; }
2625 operator local_days() const noexcept
2626 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2630 {
return _M_y.ok() && _M_mdl.ok(); }
2632 friend constexpr
bool
2633 operator==(
const year_month_day_last& __x,
2634 const year_month_day_last& __y) noexcept
2636 return __x.year() == __y.year()
2637 && __x.month_day_last() == __y.month_day_last();
2640 friend constexpr strong_ordering
2641 operator<=>(
const year_month_day_last& __x,
2642 const year_month_day_last& __y) noexcept
2645 template<
typename = __detail::__months_years_conversion_disambiguator>
2646 friend constexpr year_month_day_last
2647 operator+(
const year_month_day_last& __ymdl,
2648 const months& __dm) noexcept
2649 {
return (__ymdl.year() / __ymdl.month() + __dm) / last; }
2651 template<
typename = __detail::__months_years_conversion_disambiguator>
2652 friend constexpr year_month_day_last
2654 const year_month_day_last& __ymdl) noexcept
2655 {
return __ymdl + __dm; }
2657 template<
typename = __detail::__months_years_conversion_disambiguator>
2658 friend constexpr year_month_day_last
2659 operator-(
const year_month_day_last& __ymdl,
2660 const months& __dm) noexcept
2661 {
return __ymdl + -__dm; }
2663 friend constexpr year_month_day_last
2664 operator+(
const year_month_day_last& __ymdl,
2665 const years& __dy) noexcept
2666 {
return {__ymdl.year() + __dy, __ymdl.month_day_last()}; }
2668 friend constexpr year_month_day_last
2670 const year_month_day_last& __ymdl) noexcept
2671 {
return __ymdl + __dy; }
2673 friend constexpr year_month_day_last
2674 operator-(
const year_month_day_last& __ymdl,
2675 const years& __dy) noexcept
2676 {
return __ymdl + -__dy; }
2678 friend constexpr year_month_day_last
2679 operator/(
const year_month& __ym, last_spec) noexcept
2680 {
return {__ym.year(), chrono::month_day_last{__ym.month()}}; }
2682 friend constexpr year_month_day_last
2684 const chrono::month_day_last& __mdl) noexcept
2685 {
return {__y, __mdl}; }
2687 friend constexpr year_month_day_last
2688 operator/(
int __y,
const chrono::month_day_last& __mdl) noexcept
2689 {
return chrono::year(__y) / __mdl; }
2691 friend constexpr year_month_day_last
2692 operator/(
const chrono::month_day_last& __mdl,
2693 const chrono::year& __y) noexcept
2694 {
return __y / __mdl; }
2696 friend constexpr year_month_day_last
2697 operator/(
const chrono::month_day_last& __mdl,
int __y) noexcept
2698 {
return chrono::year(__y) / __mdl; }
2705 year_month_day::year_month_day(
const year_month_day_last& __ymdl) noexcept
2706 : _M_y{__ymdl.year()}, _M_m{__ymdl.month()}, _M_d{__ymdl.day()}
2710 year_month_day::ok() const noexcept
2712 if (!_M_y.ok() || !_M_m.ok())
2714 return chrono::day{1} <= _M_d && _M_d <= (_M_y / _M_m / last).day();
2719 class year_month_weekday
2724 chrono::weekday_indexed _M_wdi;
2726 static constexpr year_month_weekday
2727 _S_from_sys_days(
const sys_days& __dp)
2729 year_month_day __ymd{__dp};
2730 chrono::weekday __wd{__dp};
2731 auto __index = __wd[(
unsigned{__ymd.day()} - 1) / 7 + 1];
2732 return {__ymd.year(), __ymd.month(), __index};
2736 year_month_weekday() =
default;
2739 year_month_weekday(
const chrono::year& __y,
const chrono::month& __m,
2740 const chrono::weekday_indexed& __wdi) noexcept
2741 : _M_y{__y}, _M_m{__m}, _M_wdi{__wdi}
2745 year_month_weekday(
const sys_days& __dp) noexcept
2746 : year_month_weekday{_S_from_sys_days(__dp)}
2750 year_month_weekday(
const local_days& __dp) noexcept
2751 : year_month_weekday{sys_days{__dp.time_since_epoch()}}
2754 template<
typename = __detail::__months_years_conversion_disambiguator>
2755 constexpr year_month_weekday&
2756 operator+=(
const months& __m) noexcept
2758 *
this = *
this + __m;
2762 template<
typename = __detail::__months_years_conversion_disambiguator>
2763 constexpr year_month_weekday&
2764 operator-=(
const months& __m) noexcept
2766 *
this = *
this - __m;
2770 constexpr year_month_weekday&
2771 operator+=(
const years& __y) noexcept
2773 *
this = *
this + __y;
2777 constexpr year_month_weekday&
2778 operator-=(
const years& __y) noexcept
2780 *
this = *
this - __y;
2784 constexpr chrono::year
2785 year() const noexcept
2788 constexpr chrono::month
2789 month() const noexcept
2792 constexpr chrono::weekday
2793 weekday() const noexcept
2794 {
return _M_wdi.weekday(); }
2797 index() const noexcept
2798 {
return _M_wdi.index(); }
2800 constexpr chrono::weekday_indexed
2801 weekday_indexed() const noexcept
2805 operator sys_days() const noexcept
2807 auto __d = sys_days{year() / month() / 1};
2808 return __d + (weekday() - chrono::weekday(__d)
2809 + days{(
static_cast<int>(index())-1)*7});
2813 operator local_days() const noexcept
2814 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2819 if (!_M_y.ok() || !_M_m.ok() || !_M_wdi.ok())
2821 if (_M_wdi.index() <= 4)
2823 days __d = (_M_wdi.weekday()
2824 - chrono::weekday{sys_days{_M_y / _M_m / 1}}
2825 + days((_M_wdi.index()-1)*7 + 1));
2826 __glibcxx_assert(__d.count() >= 1);
2827 return __d.count() <=
unsigned{(_M_y / _M_m / last).day()};
2830 friend constexpr
bool
2831 operator==(
const year_month_weekday& __x,
2832 const year_month_weekday& __y) noexcept
2834 return __x.year() == __y.year()
2835 && __x.month() == __y.month()
2836 && __x.weekday_indexed() == __y.weekday_indexed();
2839 template<
typename = __detail::__months_years_conversion_disambiguator>
2840 friend constexpr year_month_weekday
2841 operator+(
const year_month_weekday& __ymwd,
const months& __dm) noexcept
2843 return ((__ymwd.year() / __ymwd.month() + __dm)
2844 / __ymwd.weekday_indexed());
2847 template<
typename = __detail::__months_years_conversion_disambiguator>
2848 friend constexpr year_month_weekday
2849 operator+(
const months& __dm,
const year_month_weekday& __ymwd) noexcept
2850 {
return __ymwd + __dm; }
2852 friend constexpr year_month_weekday
2853 operator+(
const year_month_weekday& __ymwd,
const years& __dy) noexcept
2854 {
return {__ymwd.year() + __dy, __ymwd.month(), __ymwd.weekday_indexed()}; }
2856 friend constexpr year_month_weekday
2857 operator+(
const years& __dy,
const year_month_weekday& __ymwd) noexcept
2858 {
return __ymwd + __dy; }
2860 template<
typename = __detail::__months_years_conversion_disambiguator>
2861 friend constexpr year_month_weekday
2862 operator-(
const year_month_weekday& __ymwd,
const months& __dm) noexcept
2863 {
return __ymwd + -__dm; }
2865 friend constexpr year_month_weekday
2866 operator-(
const year_month_weekday& __ymwd,
const years& __dy) noexcept
2867 {
return __ymwd + -__dy; }
2869 friend constexpr year_month_weekday
2871 const chrono::weekday_indexed& __wdi) noexcept
2872 {
return {__ym.year(), __ym.month(), __wdi}; }
2874 friend constexpr year_month_weekday
2875 operator/(
const chrono::year& __y,
const month_weekday& __mwd) noexcept
2876 {
return {__y, __mwd.month(), __mwd.weekday_indexed()}; }
2878 friend constexpr year_month_weekday
2879 operator/(
int __y,
const month_weekday& __mwd) noexcept
2880 {
return chrono::year(__y) / __mwd; }
2882 friend constexpr year_month_weekday
2883 operator/(
const month_weekday& __mwd,
const chrono::year& __y) noexcept
2884 {
return __y / __mwd; }
2886 friend constexpr year_month_weekday
2887 operator/(
const month_weekday& __mwd,
int __y) noexcept
2888 {
return chrono::year(__y) / __mwd; }
2895 class year_month_weekday_last
2900 chrono::weekday_last _M_wdl;
2904 year_month_weekday_last(
const chrono::year& __y,
const chrono::month& __m,
2905 const chrono::weekday_last& __wdl) noexcept
2906 : _M_y{__y}, _M_m{__m}, _M_wdl{__wdl}
2909 template<
typename = __detail::__months_years_conversion_disambiguator>
2910 constexpr year_month_weekday_last&
2911 operator+=(
const months& __m) noexcept
2913 *
this = *
this + __m;
2917 template<
typename = __detail::__months_years_conversion_disambiguator>
2918 constexpr year_month_weekday_last&
2919 operator-=(
const months& __m) noexcept
2921 *
this = *
this - __m;
2925 constexpr year_month_weekday_last&
2926 operator+=(
const years& __y) noexcept
2928 *
this = *
this + __y;
2932 constexpr year_month_weekday_last&
2933 operator-=(
const years& __y) noexcept
2935 *
this = *
this - __y;
2939 constexpr chrono::year
2940 year() const noexcept
2943 constexpr chrono::month
2944 month() const noexcept
2947 constexpr chrono::weekday
2948 weekday() const noexcept
2949 {
return _M_wdl.weekday(); }
2951 constexpr chrono::weekday_last
2952 weekday_last() const noexcept
2956 operator sys_days() const noexcept
2958 const auto __d = sys_days{_M_y / _M_m / last};
2959 return sys_days{(__d - (chrono::weekday{__d}
2960 - _M_wdl.weekday())).time_since_epoch()};
2964 operator local_days() const noexcept
2965 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2969 {
return _M_y.ok() && _M_m.ok() && _M_wdl.ok(); }
2971 friend constexpr
bool
2972 operator==(
const year_month_weekday_last& __x,
2973 const year_month_weekday_last& __y) noexcept
2975 return __x.year() == __y.year()
2976 && __x.month() == __y.month()
2977 && __x.weekday_last() == __y.weekday_last();
2980 template<
typename = __detail::__months_years_conversion_disambiguator>
2981 friend constexpr year_month_weekday_last
2982 operator+(
const year_month_weekday_last& __ymwdl,
2983 const months& __dm) noexcept
2985 return ((__ymwdl.year() / __ymwdl.month() + __dm)
2986 / __ymwdl.weekday_last());
2989 template<
typename = __detail::__months_years_conversion_disambiguator>
2990 friend constexpr year_month_weekday_last
2992 const year_month_weekday_last& __ymwdl) noexcept
2993 {
return __ymwdl + __dm; }
2995 friend constexpr year_month_weekday_last
2996 operator+(
const year_month_weekday_last& __ymwdl,
2997 const years& __dy) noexcept
2998 {
return {__ymwdl.year() + __dy, __ymwdl.month(), __ymwdl.weekday_last()}; }
3000 friend constexpr year_month_weekday_last
3002 const year_month_weekday_last& __ymwdl) noexcept
3003 {
return __ymwdl + __dy; }
3005 template<
typename = __detail::__months_years_conversion_disambiguator>
3006 friend constexpr year_month_weekday_last
3007 operator-(
const year_month_weekday_last& __ymwdl,
3008 const months& __dm) noexcept
3009 {
return __ymwdl + -__dm; }
3011 friend constexpr year_month_weekday_last
3012 operator-(
const year_month_weekday_last& __ymwdl,
3013 const years& __dy) noexcept
3014 {
return __ymwdl + -__dy; }
3016 friend constexpr year_month_weekday_last
3018 const chrono::weekday_last& __wdl) noexcept
3019 {
return {__ym.year(), __ym.month(), __wdl}; }
3021 friend constexpr year_month_weekday_last
3023 const chrono::month_weekday_last& __mwdl) noexcept
3024 {
return {__y, __mwdl.month(), __mwdl.weekday_last()}; }
3026 friend constexpr year_month_weekday_last
3027 operator/(
int __y,
const chrono::month_weekday_last& __mwdl) noexcept
3028 {
return chrono::year(__y) / __mwdl; }
3030 friend constexpr year_month_weekday_last
3031 operator/(
const chrono::month_weekday_last& __mwdl,
3032 const chrono::year& __y) noexcept
3033 {
return __y / __mwdl; }
3035 friend constexpr year_month_weekday_last
3036 operator/(
const chrono::month_weekday_last& __mwdl,
int __y) noexcept
3037 {
return chrono::year(__y) / __mwdl; }
3047 __pow10(
unsigned __n)
3056 template<
typename _Duration>
3060 static constexpr
int
3061 _S_fractional_width()
3063 int __multiplicity_2 = 0;
3064 int __multiplicity_5 = 0;
3065 auto __den = _Duration::period::den;
3066 while ((__den % 2) == 0)
3071 while ((__den % 5) == 0)
3079 int __width = (__multiplicity_2 > __multiplicity_5
3080 ? __multiplicity_2 : __multiplicity_5);
3087 static constexpr
unsigned fractional_width = {_S_fractional_width()};
3091 chrono::seconds::rep>,
3092 ratio<1, __detail::__pow10(fractional_width)>>;
3096 : hh_mm_ss{_Duration::zero()}
3100 hh_mm_ss(_Duration __d) noexcept
3101 : _M_is_neg (__d < _Duration::zero()),
3102 _M_h (duration_cast<chrono::hours>(abs(__d))),
3103 _M_m (duration_cast<chrono::minutes>(abs(__d) -
hours())),
3104 _M_s (duration_cast<chrono::seconds>(abs(__d) -
hours() -
minutes()))
3106 if constexpr (treat_as_floating_point_v<typename precision::rep>)
3114 is_negative() const noexcept
3115 {
return _M_is_neg; }
3118 hours() const noexcept
3130 subseconds() const noexcept
3134 operator precision() const noexcept
3135 {
return to_duration(); }
3138 to_duration() const noexcept
3141 return -(_M_h + _M_m + _M_s + _M_ss);
3143 return _M_h + _M_m + _M_s + _M_ss;
3160 #if __cplusplus > 201103L
3162 #define __cpp_lib_chrono_udls 201304
3164 inline namespace literals
3189 inline namespace chrono_literals
3194 #pragma GCC diagnostic push
3195 #pragma GCC diagnostic ignored "-Wliteral-suffix"
3197 template<
typename _Dur,
char... _Digits>
3198 constexpr _Dur __check_overflow()
3200 using _Val = __parse_int::_Parse_int<_Digits...>;
3201 constexpr
typename _Dur::rep __repval = _Val::value;
3202 static_assert(__repval >= 0 && __repval == _Val::value,
3203 "literal value cannot be represented by duration type");
3204 return _Dur(__repval);
3210 operator""h(
long double __hours)
3214 template <
char... _Digits>
3221 operator""min(
long double __mins)
3225 template <
char... _Digits>
3232 operator""s(
long double __secs)
3236 template <
char... _Digits>
3243 operator""ms(
long double __msecs)
3247 template <
char... _Digits>
3254 operator""us(
long double __usecs)
3258 template <
char... _Digits>
3265 operator""ns(
long double __nsecs)
3269 template <
char... _Digits>
3274 #if __cplusplus > 201703L
3275 constexpr chrono::day
3276 operator""d(
unsigned long long __d) noexcept
3277 {
return chrono::day{
static_cast<unsigned>(__d)}; }
3279 constexpr chrono::year
3280 operator""y(
unsigned long long __y) noexcept
3281 {
return chrono::year{
static_cast<int>(__y)}; }
3284 #pragma GCC diagnostic pop
3291 using namespace literals::chrono_literals;
3294 #if __cplusplus > 201703L
3303 is_am(
const hours& __h) noexcept
3304 {
return 0h <= __h && __h <= 11h; }
3307 is_pm(
const hours& __h) noexcept
3308 {
return 12h <= __h && __h <= 23h; }
3311 make12(
const hours& __h) noexcept
3321 make24(
const hours& __h,
bool __is_pm) noexcept
3342 #if __cplusplus >= 201703L
3343 namespace filesystem
3348 using rep = duration::rep;
3349 using period = duration::period;
3350 using time_point = chrono::time_point<__file_clock>;
3351 static constexpr
bool is_steady =
false;
3355 {
return _S_from_sys(chrono::system_clock::now()); }
3357 #if __cplusplus > 201703L
3358 template<
typename _Dur>
3360 chrono::file_time<_Dur>
3361 from_sys(
const chrono::sys_time<_Dur>& __t) noexcept
3362 {
return _S_from_sys(__t); }
3365 template<
typename _Dur>
3367 chrono::sys_time<_Dur>
3368 to_sys(
const chrono::file_time<_Dur>& __t) noexcept
3369 {
return _S_to_sys(__t); }
3373 using __sys_clock = chrono::system_clock;
3382 template<
typename _Dur>
3384 chrono::time_point<__file_clock, _Dur>
3385 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
3387 using __file_time = chrono::time_point<__file_clock, _Dur>;
3388 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
3392 template<
typename _Dur>
3394 chrono::time_point<__sys_clock, _Dur>
3395 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t) noexcept
3397 using __sys_time = chrono::time_point<__sys_clock, _Dur>;
3398 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
3405 _GLIBCXX_END_NAMESPACE_VERSION
3410 #endif //_GLIBCXX_CHRONO
Define a member typedef type only if a boolean constant is true.
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 const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
duration< int64_t, ratio< 3600 >> hours
hours
duration< int64_t > seconds
seconds
duration< int64_t, milli > milliseconds
milliseconds
Provides compile-time rational arithmetic.
constexpr duration< __common_rep_t< _Rep2, _Rep1 >, _Period > operator*(const _Rep1 &__s, const duration< _Rep2, _Period > &__d)
chrono::duration represents a distance between two points in time
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.
static constexpr _Tp lowest() noexcept
constexpr bool operator!=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr duration< __common_rep_t< _Rep1, _Rep2 >, _Period > operator*(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
void void_t
A metafunction that always yields void, used for detecting valid types.
constexpr bool operator==(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
chrono::time_point represents a point in time as measured by a clock
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator+(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr duration< __common_rep_t< _Rep1, __disable_if_is_duration< _Rep2 > >, _Period > operator/(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
static constexpr _Tp max() noexcept
constexpr time_point< _Clock, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator+(const time_point< _Clock, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t, ratio< 60 >> minutes
minutes
typename common_type< _Tp...>::type common_type_t
Alias template for common_type.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
constexpr enable_if< __is_duration< _ToDur >::value, time_point< _Clock, _ToDur > >::type time_point_cast(const time_point< _Clock, _Dur > &__t)
time_point_cast
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
constexpr duration< __common_rep_t< _Rep1, __disable_if_is_duration< _Rep2 > >, _Period > operator%(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
duration< int64_t, nano > nanoseconds
nanoseconds
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t, micro > microseconds
microseconds
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration_cast
Properties of fundamental types.