30#ifndef _GLIBCXX_CHRONO
31#define _GLIBCXX_CHRONO 1
33#pragma GCC system_header
35#if __cplusplus < 201103L
44#if __cplusplus > 201703L
49namespace std _GLIBCXX_VISIBILITY(default)
51_GLIBCXX_BEGIN_NAMESPACE_VERSION
53#if __cplusplus >= 201703L
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>;
108 using type = chrono::duration<__cr, typename __r::type>;
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,
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>
354 return __to - _ToDur{1};
358 template<
typename _ToDur,
typename _Rep,
typename _Period>
359 constexpr __enable_if_is_duration<_ToDur>
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,
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>
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)
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>
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<
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<
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>
605 operator%=(
const rep& __rhs)
611 template<
typename _Rep2 = rep>
615 operator%=(
const duration& __d)
622 static constexpr duration
624 {
return duration(duration_values<rep>::zero()); }
626 static constexpr duration
628 {
return duration(duration_values<rep>::min()); }
630 static constexpr duration
632 {
return duration(duration_values<rep>::max()); }
642 template<
typename _Rep1,
typename _Period1,
643 typename _Rep2,
typename _Period2>
647 const duration<_Rep2, _Period2>& __rhs)
649 typedef duration<_Rep1, _Period1> __dur1;
650 typedef duration<_Rep2, _Period2> __dur2;
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>
691 operator*(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
693 typedef duration<typename common_type<_Rep1, _Rep2>::type, _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>
761 const duration<_Rep2, _Period2>& __rhs)
763 typedef duration<_Rep1, _Period1> __dur1;
764 typedef duration<_Rep2, _Period2> __dur2;
766 return __ct(__lhs).count() == __ct(__rhs).count();
769 template<
typename _Rep1,
typename _Period1,
770 typename _Rep2,
typename _Period2>
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>
799 {
return !(__lhs == __rhs); }
802 template<
typename _Rep1,
typename _Period1,
803 typename _Rep2,
typename _Period2>
807 {
return !(__rhs < __lhs); }
809 template<
typename _Rep1,
typename _Period1,
810 typename _Rep2,
typename _Period2>
814 {
return __rhs < __lhs; }
816 template<
typename _Rep1,
typename _Period1,
817 typename _Rep2,
typename _Period2>
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;
878 typedef _Dur duration;
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>>>
892 constexpr time_point(
const time_point<clock, _Dur2>& __t)
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&
927 operator+=(
const duration& __dur)
933 _GLIBCXX17_CONSTEXPR time_point&
934 operator-=(
const duration& __dur)
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>
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>
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,
990 chrono::round<_ToDur>(__tp.time_since_epoch())};
998 template<
typename _Clock,
typename _Dur1,
999 typename _Rep2,
typename _Period2>
1001 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
1003 const duration<_Rep2, _Period2>& __rhs)
1005 typedef duration<_Rep2, _Period2> __dur2;
1007 typedef time_point<_Clock, __ct> __time_point;
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,
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>
1070 {
return !(__lhs == __rhs); }
1073 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1077 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
1079 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1083 {
return !(__rhs < __lhs); }
1085 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1089 {
return __rhs < __lhs; }
1091 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
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;
1142 _GLIBCXX_TIME_BITS64_ABI_TAG
1144 to_time_t(
const time_point& __t)
noexcept
1147 (__t.time_since_epoch()).count());
1150 _GLIBCXX_TIME_BITS64_ABI_TAG
1152 from_time_t(std::time_t __t)
noexcept
1170 typedef duration::rep rep;
1171 typedef duration::period period;
1174 static constexpr bool is_steady =
true;
1193#if __cplusplus > 201703L
1194 template<
typename _Duration>
1196 using sys_seconds = sys_time<seconds>;
1197 using sys_days = sys_time<days>;
1199 using file_clock = ::std::filesystem::__file_clock;
1201 template<
typename _Duration>
1205 template<>
struct is_clock<steady_clock> :
true_type { };
1206 template<>
struct is_clock<file_clock> : true_type { };
1208 template<>
inline constexpr bool is_clock_v<system_clock> =
true;
1209 template<>
inline constexpr bool is_clock_v<steady_clock> =
true;
1210 template<>
inline constexpr bool is_clock_v<file_clock> =
true;
1213 template<
typename _Duration>
1215 using local_seconds = local_time<seconds>;
1216 using local_days = local_time<days>;
1222 template<
typename _Duration>
1224 using utc_seconds = utc_time<seconds>;
1226 template<
typename _Duration>
1228 using tai_seconds = tai_time<seconds>;
1230 template<
typename _Duration>
1232 using gps_seconds = gps_time<seconds>;
1234 template<>
struct is_clock<utc_clock> :
true_type { };
1235 template<>
struct is_clock<tai_clock> :
true_type { };
1236 template<>
struct is_clock<gps_clock> :
true_type { };
1238 template<>
inline constexpr bool is_clock_v<utc_clock> =
true;
1239 template<>
inline constexpr bool is_clock_v<tai_clock> =
true;
1240 template<>
inline constexpr bool is_clock_v<gps_clock> =
true;
1242 struct leap_second_info
1244 bool is_leap_second;
1255 class weekday_indexed;
1258 class month_day_last;
1259 class month_weekday;
1260 class month_weekday_last;
1262 class year_month_day;
1263 class year_month_day_last;
1264 class year_month_weekday;
1265 class year_month_weekday_last;
1269 explicit last_spec() =
default;
1271 friend constexpr month_day_last
1274 friend constexpr month_day_last
1278 inline constexpr last_spec last{};
1288 __modulo(
long long __n,
unsigned __d)
1293 return (__d + (__n % __d)) % __d;
1296 inline constexpr unsigned __days_per_month[12]
1297 = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
1311 day(
unsigned __d) noexcept
1316 operator++() noexcept
1323 operator++(
int)
noexcept
1331 operator--() noexcept
1338 operator--(
int)
noexcept
1346 operator+=(
const days& __d)
noexcept
1348 *
this = *
this + __d;
1353 operator-=(
const days& __d)
noexcept
1355 *
this = *
this - __d;
1360 operator unsigned() const noexcept
1365 {
return 1 <= _M_d && _M_d <= 31; }
1367 friend constexpr bool
1368 operator==(
const day& __x,
const day& __y)
noexcept
1369 {
return unsigned{__x} ==
unsigned{__y}; }
1371 friend constexpr strong_ordering
1372 operator<=>(
const day& __x,
const day& __y)
noexcept
1373 {
return unsigned{__x} <=>
unsigned{__y}; }
1375 friend constexpr day
1376 operator+(
const day& __x,
const days& __y)
noexcept
1377 {
return day(
unsigned{__x} + __y.count()); }
1379 friend constexpr day
1380 operator+(
const days& __x,
const day& __y)
noexcept
1381 {
return __y + __x; }
1383 friend constexpr day
1384 operator-(
const day& __x,
const days& __y)
noexcept
1385 {
return __x + -__y; }
1387 friend constexpr days
1388 operator-(
const day& __x,
const day& __y)
noexcept
1389 {
return days{int(
unsigned{__x}) -
int(
unsigned{__y})}; }
1391 friend constexpr month_day
1392 operator/(
const month& __m,
const day& __d)
noexcept;
1394 friend constexpr month_day
1395 operator/(
int __m,
const day& __d)
noexcept;
1397 friend constexpr month_day
1398 operator/(
const day& __d,
const month& __m)
noexcept;
1400 friend constexpr month_day
1401 operator/(
const day& __d,
int __m)
noexcept;
1403 friend constexpr year_month_day
1404 operator/(
const year_month& __ym,
const day& __d)
noexcept;
1420 month(
unsigned __m) noexcept
1425 operator++() noexcept
1432 operator++(
int)
noexcept
1440 operator--() noexcept
1447 operator--(
int)
noexcept
1455 operator+=(
const months& __m)
noexcept
1457 *
this = *
this + __m;
1462 operator-=(
const months& __m)
noexcept
1464 *
this = *
this - __m;
1469 operator unsigned() const noexcept
1474 {
return 1 <= _M_m && _M_m <= 12; }
1476 friend constexpr bool
1477 operator==(
const month& __x,
const month& __y)
noexcept
1478 {
return unsigned{__x} ==
unsigned{__y}; }
1480 friend constexpr strong_ordering
1481 operator<=>(
const month& __x,
const month& __y)
noexcept
1482 {
return unsigned{__x} <=>
unsigned{__y}; }
1484 friend constexpr month
1485 operator+(
const month& __x,
const months& __y)
noexcept
1487 auto __n =
static_cast<long long>(
unsigned{__x}) + (__y.count() - 1);
1488 return month{__detail::__modulo(__n, 12) + 1};
1491 friend constexpr month
1492 operator+(
const months& __x,
const month& __y)
noexcept
1493 {
return __y + __x; }
1495 friend constexpr month
1496 operator-(
const month& __x,
const months& __y)
noexcept
1497 {
return __x + -__y; }
1499 friend constexpr months
1500 operator-(
const month& __x,
const month& __y)
noexcept
1502 const auto __dm = int(
unsigned(__x)) - int(
unsigned(__y));
1503 return months{__dm < 0 ? 12 + __dm : __dm};
1506 friend constexpr year_month
1507 operator/(
const year& __y,
const month& __m)
noexcept;
1509 friend constexpr month_day
1510 operator/(
const month& __m,
int __d)
noexcept;
1512 friend constexpr month_day_last
1513 operator/(
const month& __m, last_spec)
noexcept;
1515 friend constexpr month_day_last
1516 operator/(last_spec,
const month& __m)
noexcept;
1518 friend constexpr month_weekday
1519 operator/(
const month& __m,
const weekday_indexed& __wdi)
noexcept;
1521 friend constexpr month_weekday
1522 operator/(
const weekday_indexed& __wdi,
const month& __m)
noexcept;
1524 friend constexpr month_weekday_last
1525 operator/(
const month& __m,
const weekday_last& __wdl)
noexcept;
1527 friend constexpr month_weekday_last
1528 operator/(
const weekday_last& __wdl,
const month& __m)
noexcept;
1533 inline constexpr month January{1};
1534 inline constexpr month February{2};
1535 inline constexpr month March{3};
1536 inline constexpr month April{4};
1537 inline constexpr month May{5};
1538 inline constexpr month June{6};
1539 inline constexpr month July{7};
1540 inline constexpr month August{8};
1541 inline constexpr month September{9};
1542 inline constexpr month October{10};
1543 inline constexpr month November{11};
1544 inline constexpr month December{12};
1557 year(
int __y) noexcept
1558 : _M_y{
static_cast<short>(__y)}
1561 static constexpr year
1563 {
return year{-32767}; }
1565 static constexpr year
1567 {
return year{32767}; }
1570 operator++() noexcept
1577 operator++(
int)
noexcept
1585 operator--() noexcept
1592 operator--(
int)
noexcept
1600 operator+=(
const years& __y)
noexcept
1602 *
this = *
this + __y;
1607 operator-=(
const years& __y)
noexcept
1609 *
this = *
this - __y;
1619 {
return year{-_M_y}; }
1622 is_leap() const noexcept
1635 constexpr uint32_t __multiplier = 42949673;
1636 constexpr uint32_t __bound = 42949669;
1637 constexpr uint32_t __max_dividend = 1073741799;
1638 constexpr uint32_t __offset = __max_dividend / 2 / 100 * 100;
1639 const bool __is_multiple_of_100
1640 = __multiplier * (_M_y + __offset) < __bound;
1641 return (!__is_multiple_of_100 || _M_y % 400 == 0) && _M_y % 4 == 0;
1645 operator int() const noexcept
1650 {
return min()._M_y <= _M_y && _M_y <=
max()._M_y; }
1652 friend constexpr bool
1653 operator==(
const year& __x,
const year& __y)
noexcept
1654 {
return int{__x} ==
int{__y}; }
1656 friend constexpr strong_ordering
1657 operator<=>(
const year& __x,
const year& __y)
noexcept
1658 {
return int{__x} <=>
int{__y}; }
1660 friend constexpr year
1661 operator+(
const year& __x,
const years& __y)
noexcept
1662 {
return year{
int{__x} +
static_cast<int>(__y.count())}; }
1664 friend constexpr year
1665 operator+(
const years& __x,
const year& __y)
noexcept
1666 {
return __y + __x; }
1668 friend constexpr year
1669 operator-(
const year& __x,
const years& __y)
noexcept
1670 {
return __x + -__y; }
1672 friend constexpr years
1673 operator-(
const year& __x,
const year& __y)
noexcept
1674 {
return years{
int{__x} -
int{__y}}; }
1676 friend constexpr year_month
1677 operator/(
const year& __y,
int __m)
noexcept;
1679 friend constexpr year_month_day
1680 operator/(
const year& __y,
const month_day& __md)
noexcept;
1682 friend constexpr year_month_day
1683 operator/(
const month_day& __md,
const year& __y)
noexcept;
1685 friend constexpr year_month_day_last
1686 operator/(
const year& __y,
const month_day_last& __mdl)
noexcept;
1688 friend constexpr year_month_day_last
1689 operator/(
const month_day_last& __mdl,
const year& __y)
noexcept;
1691 friend constexpr year_month_weekday
1692 operator/(
const year& __y,
const month_weekday& __mwd)
noexcept;
1694 friend constexpr year_month_weekday
1695 operator/(
const month_weekday& __mwd,
const year& __y)
noexcept;
1697 friend constexpr year_month_weekday_last
1698 operator/(
const year& __y,
const month_weekday_last& __mwdl)
noexcept;
1700 friend constexpr year_month_weekday_last
1701 operator/(
const month_weekday_last& __mwdl,
const year& __y)
noexcept;
1711 unsigned char _M_wd;
1713 static constexpr weekday
1714 _S_from_days(
const days& __d)
1716 auto __n = __d.count();
1717 return weekday(__n >= -4 ? (__n + 4) % 7 : (__n + 5) % 7 + 6);
1721 weekday() =
default;
1724 weekday(
unsigned __wd) noexcept
1725 : _M_wd(__wd == 7 ? 0 : __wd)
1729 weekday(
const sys_days& __dp) noexcept
1730 : weekday{_S_from_days(__dp.time_since_epoch())}
1734 weekday(
const local_days& __dp) noexcept
1735 : weekday{sys_days{__dp.time_since_epoch()}}
1739 operator++() noexcept
1746 operator++(
int)
noexcept
1754 operator--() noexcept
1761 operator--(
int)
noexcept
1769 operator+=(
const days& __d)
noexcept
1771 *
this = *
this + __d;
1776 operator-=(
const days& __d)
noexcept
1778 *
this = *
this - __d;
1783 c_encoding() const noexcept
1787 iso_encoding() const noexcept
1788 {
return _M_wd == 0u ? 7u : _M_wd; }
1792 {
return _M_wd <= 6; }
1794 constexpr weekday_indexed
1795 operator[](
unsigned __index)
const noexcept;
1797 constexpr weekday_last
1798 operator[](last_spec)
const noexcept;
1800 friend constexpr bool
1801 operator==(
const weekday& __x,
const weekday& __y)
noexcept
1802 {
return __x._M_wd == __y._M_wd; }
1804 friend constexpr weekday
1805 operator+(
const weekday& __x,
const days& __y)
noexcept
1807 auto __n =
static_cast<long long>(__x._M_wd) + __y.count();
1808 return weekday{__detail::__modulo(__n, 7)};
1811 friend constexpr weekday
1812 operator+(
const days& __x,
const weekday& __y)
noexcept
1813 {
return __y + __x; }
1815 friend constexpr weekday
1816 operator-(
const weekday& __x,
const days& __y)
noexcept
1817 {
return __x + -__y; }
1819 friend constexpr days
1820 operator-(
const weekday& __x,
const weekday& __y)
noexcept
1822 auto __n =
static_cast<long long>(__x._M_wd) - __y._M_wd;
1823 return days{__detail::__modulo(__n, 7)};
1829 inline constexpr weekday Sunday{0};
1830 inline constexpr weekday Monday{1};
1831 inline constexpr weekday Tuesday{2};
1832 inline constexpr weekday Wednesday{3};
1833 inline constexpr weekday Thursday{4};
1834 inline constexpr weekday Friday{5};
1835 inline constexpr weekday Saturday{6};
1839 class weekday_indexed
1842 chrono::weekday _M_wd;
1843 unsigned char _M_index;
1846 weekday_indexed() =
default;
1849 weekday_indexed(
const chrono::weekday& __wd,
unsigned __index) noexcept
1850 : _M_wd(__wd), _M_index(__index)
1853 constexpr chrono::weekday
1854 weekday() const noexcept
1858 index() const noexcept
1859 {
return _M_index; };
1863 {
return _M_wd.ok() && 1 <= _M_index && _M_index <= 5; }
1865 friend constexpr bool
1866 operator==(
const weekday_indexed& __x,
const weekday_indexed& __y)
noexcept
1867 {
return __x.weekday() == __y.weekday() && __x.index() == __y.index(); }
1869 friend constexpr month_weekday
1870 operator/(
const month& __m,
const weekday_indexed& __wdi)
noexcept;
1872 friend constexpr month_weekday
1873 operator/(
int __m,
const weekday_indexed& __wdi)
noexcept;
1875 friend constexpr month_weekday
1876 operator/(
const weekday_indexed& __wdi,
const month& __m)
noexcept;
1878 friend constexpr month_weekday
1879 operator/(
const weekday_indexed& __wdi,
int __m)
noexcept;
1881 friend constexpr year_month_weekday
1882 operator/(
const year_month& __ym,
const weekday_indexed& __wdi)
noexcept;
1887 constexpr weekday_indexed
1888 weekday::operator[](
unsigned __index)
const noexcept
1889 {
return {*
this, __index}; }
1896 chrono::weekday _M_wd;
1900 weekday_last(
const chrono::weekday& __wd) noexcept
1904 constexpr chrono::weekday
1905 weekday() const noexcept
1910 {
return _M_wd.ok(); }
1912 friend constexpr bool
1913 operator==(
const weekday_last& __x,
const weekday_last& __y)
noexcept
1914 {
return __x.weekday() == __y.weekday(); }
1916 friend constexpr month_weekday_last
1917 operator/(
int __m,
const weekday_last& __wdl)
noexcept;
1919 friend constexpr month_weekday_last
1920 operator/(
const weekday_last& __wdl,
int __m)
noexcept;
1922 friend constexpr year_month_weekday_last
1923 operator/(
const year_month& __ym,
const weekday_last& __wdl)
noexcept;
1928 constexpr weekday_last
1929 weekday::operator[](last_spec)
const noexcept
1930 {
return weekday_last{*
this}; }
1941 month_day() =
default;
1944 month_day(
const chrono::month& __m,
const chrono::day& __d) noexcept
1945 : _M_m{__m}, _M_d{__d}
1948 constexpr chrono::month
1949 month() const noexcept
1952 constexpr chrono::day
1953 day() const noexcept
1960 && 1u <= unsigned(_M_d)
1961 && unsigned(_M_d) <= __detail::__days_per_month[unsigned(_M_m) - 1];
1964 friend constexpr bool
1965 operator==(
const month_day& __x,
const month_day& __y)
noexcept
1966 {
return __x.month() == __y.month() && __x.day() == __y.day(); }
1968 friend constexpr strong_ordering
1969 operator<=>(
const month_day& __x,
const month_day& __y)
noexcept
1972 friend constexpr month_day
1973 operator/(
const chrono::month& __m,
const chrono::day& __d)
noexcept
1974 {
return {__m, __d}; }
1976 friend constexpr month_day
1977 operator/(
const chrono::month& __m,
int __d)
noexcept
1978 {
return {__m, chrono::day(
unsigned(__d))}; }
1980 friend constexpr month_day
1981 operator/(
int __m,
const chrono::day& __d)
noexcept
1982 {
return {chrono::month(
unsigned(__m)), __d}; }
1984 friend constexpr month_day
1985 operator/(
const chrono::day& __d,
const chrono::month& __m)
noexcept
1986 {
return {__m, __d}; }
1988 friend constexpr month_day
1989 operator/(
const chrono::day& __d,
int __m)
noexcept
1990 {
return {chrono::month(
unsigned(__m)), __d}; }
1992 friend constexpr year_month_day
1993 operator/(
int __y,
const month_day& __md)
noexcept;
1995 friend constexpr year_month_day
1996 operator/(
const month_day& __md,
int __y)
noexcept;
2003 class month_day_last
2010 month_day_last(
const chrono::month& __m) noexcept
2014 constexpr chrono::month
2015 month() const noexcept
2020 {
return _M_m.ok(); }
2022 friend constexpr bool
2023 operator==(
const month_day_last& __x,
const month_day_last& __y)
noexcept
2024 {
return __x.month() == __y.month(); }
2026 friend constexpr strong_ordering
2027 operator<=>(
const month_day_last& __x,
const month_day_last& __y)
noexcept
2030 friend constexpr month_day_last
2031 operator/(
const chrono::month& __m, last_spec)
noexcept
2032 {
return month_day_last{__m}; }
2034 friend constexpr month_day_last
2036 {
return chrono::month(
unsigned(__m)) / last; }
2038 friend constexpr month_day_last
2039 operator/(last_spec,
const chrono::month& __m)
noexcept
2040 {
return __m / last; }
2042 friend constexpr month_day_last
2044 {
return __m / last; }
2046 friend constexpr year_month_day_last
2047 operator/(
int __y,
const month_day_last& __mdl)
noexcept;
2049 friend constexpr year_month_day_last
2050 operator/(
const month_day_last& __mdl,
int __y)
noexcept;
2061 chrono::weekday_indexed _M_wdi;
2065 month_weekday(
const chrono::month& __m,
2066 const chrono::weekday_indexed& __wdi) noexcept
2067 : _M_m{__m}, _M_wdi{__wdi}
2070 constexpr chrono::month
2071 month() const noexcept
2074 constexpr chrono::weekday_indexed
2075 weekday_indexed() const noexcept
2080 {
return _M_m.ok() && _M_wdi.ok(); }
2082 friend constexpr bool
2083 operator==(
const month_weekday& __x,
const month_weekday& __y)
noexcept
2085 return __x.month() == __y.month()
2086 && __x.weekday_indexed() == __y.weekday_indexed();
2089 friend constexpr month_weekday
2091 const chrono::weekday_indexed& __wdi)
noexcept
2092 {
return {__m, __wdi}; }
2094 friend constexpr month_weekday
2095 operator/(
int __m,
const chrono::weekday_indexed& __wdi)
noexcept
2096 {
return chrono::month(
unsigned(__m)) / __wdi; }
2098 friend constexpr month_weekday
2099 operator/(
const chrono::weekday_indexed& __wdi,
2100 const chrono::month& __m)
noexcept
2101 {
return __m / __wdi; }
2103 friend constexpr month_weekday
2104 operator/(
const chrono::weekday_indexed& __wdi,
int __m)
noexcept
2105 {
return __m / __wdi; }
2107 friend constexpr year_month_weekday
2108 operator/(
int __y,
const month_weekday& __mwd)
noexcept;
2110 friend constexpr year_month_weekday
2111 operator/(
const month_weekday& __mwd,
int __y)
noexcept;
2118 class month_weekday_last
2122 chrono::weekday_last _M_wdl;
2126 month_weekday_last(
const chrono::month& __m,
2127 const chrono::weekday_last& __wdl) noexcept
2128 :_M_m{__m}, _M_wdl{__wdl}
2131 constexpr chrono::month
2132 month() const noexcept
2135 constexpr chrono::weekday_last
2136 weekday_last() const noexcept
2141 {
return _M_m.ok() && _M_wdl.ok(); }
2143 friend constexpr bool
2144 operator==(
const month_weekday_last& __x,
2145 const month_weekday_last& __y)
noexcept
2147 return __x.month() == __y.month()
2148 && __x.weekday_last() == __y.weekday_last();
2151 friend constexpr month_weekday_last
2153 const chrono::weekday_last& __wdl)
noexcept
2154 {
return {__m, __wdl}; }
2156 friend constexpr month_weekday_last
2157 operator/(
int __m,
const chrono::weekday_last& __wdl)
noexcept
2158 {
return chrono::month(
unsigned(__m)) / __wdl; }
2160 friend constexpr month_weekday_last
2161 operator/(
const chrono::weekday_last& __wdl,
2162 const chrono::month& __m)
noexcept
2163 {
return __m / __wdl; }
2165 friend constexpr month_weekday_last
2166 operator/(
const chrono::weekday_last& __wdl,
int __m)
noexcept
2167 {
return chrono::month(
unsigned(__m)) / __wdl; }
2169 friend constexpr year_month_weekday_last
2170 operator/(
int __y,
const month_weekday_last& __mwdl)
noexcept;
2172 friend constexpr year_month_weekday_last
2173 operator/(
const month_weekday_last& __mwdl,
int __y)
noexcept;
2194 using __months_years_conversion_disambiguator = void;
2204 year_month() =
default;
2207 year_month(
const chrono::year& __y,
const chrono::month& __m) noexcept
2208 : _M_y{__y}, _M_m{__m}
2211 constexpr chrono::year
2212 year() const noexcept
2215 constexpr chrono::month
2216 month() const noexcept
2219 template<
typename = __detail::__months_years_conversion_disambiguator>
2220 constexpr year_month&
2221 operator+=(
const months& __dm)
noexcept
2223 *
this = *
this + __dm;
2227 template<
typename = __detail::__months_years_conversion_disambiguator>
2228 constexpr year_month&
2229 operator-=(
const months& __dm)
noexcept
2231 *
this = *
this - __dm;
2235 constexpr year_month&
2236 operator+=(
const years& __dy)
noexcept
2238 *
this = *
this + __dy;
2242 constexpr year_month&
2243 operator-=(
const years& __dy)
noexcept
2245 *
this = *
this - __dy;
2251 {
return _M_y.ok() && _M_m.ok(); }
2253 friend constexpr bool
2254 operator==(
const year_month& __x,
const year_month& __y)
noexcept
2255 {
return __x.year() == __y.year() && __x.month() == __y.month(); }
2257 friend constexpr strong_ordering
2258 operator<=>(
const year_month& __x,
const year_month& __y)
noexcept
2261 template<
typename = __detail::__months_years_conversion_disambiguator>
2262 friend constexpr year_month
2263 operator+(
const year_month& __ym,
const months& __dm)
noexcept
2266 auto __m = __ym.month() + __dm;
2267 auto __i = int(
unsigned(__ym.month())) - 1 + __dm.count();
2269 ? __ym.year() + years{(__i - 11) / 12}
2270 : __ym.year() + years{__i / 12});
2274 template<
typename = __detail::__months_years_conversion_disambiguator>
2275 friend constexpr year_month
2276 operator+(
const months& __dm,
const year_month& __ym)
noexcept
2277 {
return __ym + __dm; }
2279 template<
typename = __detail::__months_years_conversion_disambiguator>
2280 friend constexpr year_month
2281 operator-(
const year_month& __ym,
const months& __dm)
noexcept
2282 {
return __ym + -__dm; }
2284 friend constexpr months
2285 operator-(
const year_month& __x,
const year_month& __y)
noexcept
2287 return (__x.year() - __y.year()
2288 + months{static_cast<int>(unsigned{__x.month()})
2289 -
static_cast<int>(
unsigned{__y.month()})});
2292 friend constexpr year_month
2293 operator+(
const year_month& __ym,
const years& __dy)
noexcept
2294 {
return (__ym.year() + __dy) / __ym.month(); }
2296 friend constexpr year_month
2297 operator+(
const years& __dy,
const year_month& __ym)
noexcept
2298 {
return __ym + __dy; }
2300 friend constexpr year_month
2301 operator-(
const year_month& __ym,
const years& __dy)
noexcept
2302 {
return __ym + -__dy; }
2304 friend constexpr year_month
2305 operator/(
const chrono::year& __y,
const chrono::month& __m)
noexcept
2306 {
return {__y, __m}; }
2308 friend constexpr year_month
2309 operator/(
const chrono::year& __y,
int __m)
noexcept
2310 {
return {__y, chrono::month(
unsigned(__m))}; }
2312 friend constexpr year_month_day
2313 operator/(
const year_month& __ym,
int __d)
noexcept;
2315 friend constexpr year_month_day_last
2316 operator/(
const year_month& __ym, last_spec)
noexcept;
2323 class year_month_day
2330 static constexpr year_month_day _S_from_days(
const days& __dp)
noexcept;
2332 constexpr days _M_days_since_epoch() const noexcept;
2335 year_month_day() = default;
2338 year_month_day(const chrono::year& __y, const chrono::month& __m,
2339 const chrono::day& __d) noexcept
2340 : _M_y{__y}, _M_m{__m}, _M_d{__d}
2344 year_month_day(
const year_month_day_last& __ymdl)
noexcept;
2347 year_month_day(
const sys_days& __dp) noexcept
2348 : year_month_day(_S_from_days(__dp.time_since_epoch()))
2352 year_month_day(
const local_days& __dp) noexcept
2353 : year_month_day(sys_days{__dp.time_since_epoch()})
2356 template<
typename = __detail::__months_years_conversion_disambiguator>
2357 constexpr year_month_day&
2358 operator+=(
const months& __m)
noexcept
2360 *
this = *
this + __m;
2364 template<
typename = __detail::__months_years_conversion_disambiguator>
2365 constexpr year_month_day&
2366 operator-=(
const months& __m)
noexcept
2368 *
this = *
this - __m;
2372 constexpr year_month_day&
2373 operator+=(
const years& __y)
noexcept
2375 *
this = *
this + __y;
2379 constexpr year_month_day&
2380 operator-=(
const years& __y)
noexcept
2382 *
this = *
this - __y;
2386 constexpr chrono::year
2387 year() const noexcept
2390 constexpr chrono::month
2391 month() const noexcept
2394 constexpr chrono::day
2395 day() const noexcept
2399 operator sys_days() const noexcept
2400 {
return sys_days{_M_days_since_epoch()}; }
2403 operator local_days() const noexcept
2404 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2406 constexpr bool ok() const noexcept;
2408 friend constexpr
bool
2409 operator==(const year_month_day& __x, const year_month_day& __y) noexcept
2411 return __x.year() == __y.year()
2412 && __x.month() == __y.month()
2413 && __x.day() == __y.day();
2416 friend constexpr strong_ordering
2417 operator<=>(
const year_month_day& __x,
const year_month_day& __y)
noexcept
2420 template<
typename = __detail::__months_years_conversion_disambiguator>
2421 friend constexpr year_month_day
2422 operator+(
const year_month_day& __ymd,
const months& __dm)
noexcept
2423 {
return (__ymd.year() / __ymd.month() + __dm) / __ymd.day(); }
2425 template<
typename = __detail::__months_years_conversion_disambiguator>
2426 friend constexpr year_month_day
2427 operator+(
const months& __dm,
const year_month_day& __ymd)
noexcept
2428 {
return __ymd + __dm; }
2430 friend constexpr year_month_day
2431 operator+(
const year_month_day& __ymd,
const years& __dy)
noexcept
2432 {
return (__ymd.year() + __dy) / __ymd.month() / __ymd.day(); }
2434 friend constexpr year_month_day
2435 operator+(
const years& __dy,
const year_month_day& __ymd)
noexcept
2436 {
return __ymd + __dy; }
2438 template<
typename = __detail::__months_years_conversion_disambiguator>
2439 friend constexpr year_month_day
2440 operator-(
const year_month_day& __ymd,
const months& __dm)
noexcept
2441 {
return __ymd + -__dm; }
2443 friend constexpr year_month_day
2444 operator-(
const year_month_day& __ymd,
const years& __dy)
noexcept
2445 {
return __ymd + -__dy; }
2447 friend constexpr year_month_day
2448 operator/(
const year_month& __ym,
const chrono::day& __d)
noexcept
2449 {
return {__ym.year(), __ym.month(), __d}; }
2451 friend constexpr year_month_day
2452 operator/(
const year_month& __ym,
int __d)
noexcept
2453 {
return __ym / chrono::day{unsigned(__d)}; }
2455 friend constexpr year_month_day
2456 operator/(
const chrono::year& __y,
const month_day& __md)
noexcept
2457 {
return __y / __md.month() / __md.day(); }
2459 friend constexpr year_month_day
2460 operator/(
int __y,
const month_day& __md)
noexcept
2461 {
return chrono::year{__y} / __md; }
2463 friend constexpr year_month_day
2464 operator/(
const month_day& __md,
const chrono::year& __y)
noexcept
2465 {
return __y / __md; }
2467 friend constexpr year_month_day
2468 operator/(
const month_day& __md,
int __y)
noexcept
2469 {
return chrono::year(__y) / __md; }
2478 constexpr year_month_day
2479 year_month_day::_S_from_days(
const days& __dp)
noexcept
2481 constexpr auto __z2 =
static_cast<uint32_t
>(-1468000);
2482 constexpr auto __r2_e3 =
static_cast<uint32_t
>(536895458);
2484 const auto __r0 =
static_cast<uint32_t
>(__dp.count()) + __r2_e3;
2486 const auto __n1 = 4 * __r0 + 3;
2487 const auto __q1 = __n1 / 146097;
2488 const auto __r1 = __n1 % 146097 / 4;
2490 constexpr auto __p32 =
static_cast<uint64_t
>(1) << 32;
2491 const auto __n2 = 4 * __r1 + 3;
2492 const auto __u2 =
static_cast<uint64_t
>(2939745) * __n2;
2493 const auto __q2 =
static_cast<uint32_t
>(__u2 / __p32);
2494 const auto __r2 =
static_cast<uint32_t
>(__u2 % __p32) / 2939745 / 4;
2496 constexpr auto __p16 =
static_cast<uint32_t
>(1) << 16;
2497 const auto __n3 = 2141 * __r2 + 197913;
2498 const auto __q3 = __n3 / __p16;
2499 const auto __r3 = __n3 % __p16 / 2141;
2501 const auto __y0 = 100 * __q1 + __q2;
2502 const auto __m0 = __q3;
2503 const auto __d0 = __r3;
2505 const auto __j = __r2 >= 306;
2506 const auto __y1 = __y0 + __j;
2507 const auto __m1 = __j ? __m0 - 12 : __m0;
2508 const auto __d1 = __d0 + 1;
2510 return year_month_day{chrono::year{
static_cast<int>(__y1 + __z2)},
2511 chrono::month{__m1}, chrono::day{__d1}};
2519 year_month_day::_M_days_since_epoch() const noexcept
2521 auto constexpr __z2 =
static_cast<uint32_t
>(-1468000);
2522 auto constexpr __r2_e3 =
static_cast<uint32_t
>(536895458);
2524 const auto __y1 =
static_cast<uint32_t
>(
static_cast<int>(_M_y)) - __z2;
2525 const auto __m1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_m));
2526 const auto __d1 =
static_cast<uint32_t
>(
static_cast<unsigned>(_M_d));
2528 const auto __j =
static_cast<uint32_t
>(__m1 < 3);
2529 const auto __y0 = __y1 - __j;
2530 const auto __m0 = __j ? __m1 + 12 : __m1;
2531 const auto __d0 = __d1 - 1;
2533 const auto __q1 = __y0 / 100;
2534 const auto __yc = 1461 * __y0 / 4 - __q1 + __q1 / 4;
2535 const auto __mc = (979 *__m0 - 2919) / 32;
2536 const auto __dc = __d0;
2538 return days{
static_cast<int32_t
>(__yc + __mc + __dc - __r2_e3)};
2543 class year_month_day_last
2547 chrono::month_day_last _M_mdl;
2551 year_month_day_last(
const chrono::year& __y,
2552 const chrono::month_day_last& __mdl) noexcept
2553 : _M_y{__y}, _M_mdl{__mdl}
2556 template<
typename = __detail::__months_years_conversion_disambiguator>
2557 constexpr year_month_day_last&
2558 operator+=(
const months& __m)
noexcept
2560 *
this = *
this + __m;
2564 template<
typename = __detail::__months_years_conversion_disambiguator>
2565 constexpr year_month_day_last&
2566 operator-=(
const months& __m)
noexcept
2568 *
this = *
this - __m;
2572 constexpr year_month_day_last&
2573 operator+=(
const years& __y)
noexcept
2575 *
this = *
this + __y;
2579 constexpr year_month_day_last&
2580 operator-=(
const years& __y)
noexcept
2582 *
this = *
this - __y;
2586 constexpr chrono::year
2587 year() const noexcept
2590 constexpr chrono::month
2591 month() const noexcept
2592 {
return _M_mdl.month(); }
2594 constexpr chrono::month_day_last
2595 month_day_last() const noexcept
2599 constexpr chrono::day
2600 day() const noexcept
2602 const auto __m =
static_cast<unsigned>(month());
2618 return chrono::day{__m != 2 ? ((__m ^ (__m >> 3)) & 1) | 30
2619 : _M_y.is_leap() ? 29 : 28};
2623 operator sys_days() const noexcept
2624 {
return sys_days{year() / month() / day()}; }
2627 operator local_days() const noexcept
2628 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2632 {
return _M_y.ok() && _M_mdl.ok(); }
2634 friend constexpr bool
2635 operator==(
const year_month_day_last& __x,
2636 const year_month_day_last& __y)
noexcept
2638 return __x.year() == __y.year()
2639 && __x.month_day_last() == __y.month_day_last();
2642 friend constexpr strong_ordering
2643 operator<=>(
const year_month_day_last& __x,
2644 const year_month_day_last& __y)
noexcept
2647 template<
typename = __detail::__months_years_conversion_disambiguator>
2648 friend constexpr year_month_day_last
2649 operator+(
const year_month_day_last& __ymdl,
2650 const months& __dm)
noexcept
2651 {
return (__ymdl.year() / __ymdl.month() + __dm) / last; }
2653 template<
typename = __detail::__months_years_conversion_disambiguator>
2654 friend constexpr year_month_day_last
2656 const year_month_day_last& __ymdl)
noexcept
2657 {
return __ymdl + __dm; }
2659 template<
typename = __detail::__months_years_conversion_disambiguator>
2660 friend constexpr year_month_day_last
2661 operator-(
const year_month_day_last& __ymdl,
2662 const months& __dm)
noexcept
2663 {
return __ymdl + -__dm; }
2665 friend constexpr year_month_day_last
2666 operator+(
const year_month_day_last& __ymdl,
2667 const years& __dy)
noexcept
2668 {
return {__ymdl.year() + __dy, __ymdl.month_day_last()}; }
2670 friend constexpr year_month_day_last
2672 const year_month_day_last& __ymdl)
noexcept
2673 {
return __ymdl + __dy; }
2675 friend constexpr year_month_day_last
2676 operator-(
const year_month_day_last& __ymdl,
2677 const years& __dy)
noexcept
2678 {
return __ymdl + -__dy; }
2680 friend constexpr year_month_day_last
2681 operator/(
const year_month& __ym, last_spec)
noexcept
2682 {
return {__ym.year(), chrono::month_day_last{__ym.month()}}; }
2684 friend constexpr year_month_day_last
2686 const chrono::month_day_last& __mdl)
noexcept
2687 {
return {__y, __mdl}; }
2689 friend constexpr year_month_day_last
2690 operator/(
int __y,
const chrono::month_day_last& __mdl)
noexcept
2691 {
return chrono::year(__y) / __mdl; }
2693 friend constexpr year_month_day_last
2694 operator/(
const chrono::month_day_last& __mdl,
2695 const chrono::year& __y)
noexcept
2696 {
return __y / __mdl; }
2698 friend constexpr year_month_day_last
2699 operator/(
const chrono::month_day_last& __mdl,
int __y)
noexcept
2700 {
return chrono::year(__y) / __mdl; }
2707 year_month_day::year_month_day(
const year_month_day_last& __ymdl) noexcept
2708 : _M_y{__ymdl.year()}, _M_m{__ymdl.month()}, _M_d{__ymdl.day()}
2712 year_month_day::ok() const noexcept
2714 if (!_M_y.ok() || !_M_m.ok())
2716 return chrono::day{1} <= _M_d && _M_d <= (_M_y / _M_m / last).day();
2721 class year_month_weekday
2726 chrono::weekday_indexed _M_wdi;
2728 static constexpr year_month_weekday
2729 _S_from_sys_days(
const sys_days& __dp)
2731 year_month_day __ymd{__dp};
2732 chrono::weekday __wd{__dp};
2733 auto __index = __wd[(
unsigned{__ymd.day()} - 1) / 7 + 1];
2734 return {__ymd.year(), __ymd.month(), __index};
2738 year_month_weekday() =
default;
2741 year_month_weekday(
const chrono::year& __y,
const chrono::month& __m,
2742 const chrono::weekday_indexed& __wdi) noexcept
2743 : _M_y{__y}, _M_m{__m}, _M_wdi{__wdi}
2747 year_month_weekday(
const sys_days& __dp) noexcept
2748 : year_month_weekday{_S_from_sys_days(__dp)}
2752 year_month_weekday(
const local_days& __dp) noexcept
2753 : year_month_weekday{sys_days{__dp.time_since_epoch()}}
2756 template<
typename = __detail::__months_years_conversion_disambiguator>
2757 constexpr year_month_weekday&
2758 operator+=(
const months& __m)
noexcept
2760 *
this = *
this + __m;
2764 template<
typename = __detail::__months_years_conversion_disambiguator>
2765 constexpr year_month_weekday&
2766 operator-=(
const months& __m)
noexcept
2768 *
this = *
this - __m;
2772 constexpr year_month_weekday&
2773 operator+=(
const years& __y)
noexcept
2775 *
this = *
this + __y;
2779 constexpr year_month_weekday&
2780 operator-=(
const years& __y)
noexcept
2782 *
this = *
this - __y;
2786 constexpr chrono::year
2787 year() const noexcept
2790 constexpr chrono::month
2791 month() const noexcept
2794 constexpr chrono::weekday
2795 weekday() const noexcept
2796 {
return _M_wdi.weekday(); }
2799 index() const noexcept
2800 {
return _M_wdi.index(); }
2802 constexpr chrono::weekday_indexed
2803 weekday_indexed() const noexcept
2807 operator sys_days() const noexcept
2809 auto __d = sys_days{year() / month() / 1};
2810 return __d + (weekday() - chrono::weekday(__d)
2811 + days{(
static_cast<int>(index())-1)*7});
2815 operator local_days() const noexcept
2816 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2821 if (!_M_y.ok() || !_M_m.ok() || !_M_wdi.ok())
2823 if (_M_wdi.index() <= 4)
2825 days __d = (_M_wdi.weekday()
2826 - chrono::weekday{sys_days{_M_y / _M_m / 1}}
2827 + days((_M_wdi.index()-1)*7 + 1));
2828 __glibcxx_assert(__d.count() >= 1);
2829 return __d.count() <=
unsigned{(_M_y / _M_m / last).day()};
2832 friend constexpr bool
2833 operator==(
const year_month_weekday& __x,
2834 const year_month_weekday& __y)
noexcept
2836 return __x.year() == __y.year()
2837 && __x.month() == __y.month()
2838 && __x.weekday_indexed() == __y.weekday_indexed();
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
2845 return ((__ymwd.year() / __ymwd.month() + __dm)
2846 / __ymwd.weekday_indexed());
2849 template<
typename = __detail::__months_years_conversion_disambiguator>
2850 friend constexpr year_month_weekday
2851 operator+(
const months& __dm,
const year_month_weekday& __ymwd)
noexcept
2852 {
return __ymwd + __dm; }
2854 friend constexpr year_month_weekday
2855 operator+(
const year_month_weekday& __ymwd,
const years& __dy)
noexcept
2856 {
return {__ymwd.year() + __dy, __ymwd.month(), __ymwd.weekday_indexed()}; }
2858 friend constexpr year_month_weekday
2859 operator+(
const years& __dy,
const year_month_weekday& __ymwd)
noexcept
2860 {
return __ymwd + __dy; }
2862 template<
typename = __detail::__months_years_conversion_disambiguator>
2863 friend constexpr year_month_weekday
2864 operator-(
const year_month_weekday& __ymwd,
const months& __dm)
noexcept
2865 {
return __ymwd + -__dm; }
2867 friend constexpr year_month_weekday
2868 operator-(
const year_month_weekday& __ymwd,
const years& __dy)
noexcept
2869 {
return __ymwd + -__dy; }
2871 friend constexpr year_month_weekday
2873 const chrono::weekday_indexed& __wdi)
noexcept
2874 {
return {__ym.year(), __ym.month(), __wdi}; }
2876 friend constexpr year_month_weekday
2877 operator/(
const chrono::year& __y,
const month_weekday& __mwd)
noexcept
2878 {
return {__y, __mwd.month(), __mwd.weekday_indexed()}; }
2880 friend constexpr year_month_weekday
2881 operator/(
int __y,
const month_weekday& __mwd)
noexcept
2882 {
return chrono::year(__y) / __mwd; }
2884 friend constexpr year_month_weekday
2885 operator/(
const month_weekday& __mwd,
const chrono::year& __y)
noexcept
2886 {
return __y / __mwd; }
2888 friend constexpr year_month_weekday
2889 operator/(
const month_weekday& __mwd,
int __y)
noexcept
2890 {
return chrono::year(__y) / __mwd; }
2897 class year_month_weekday_last
2902 chrono::weekday_last _M_wdl;
2906 year_month_weekday_last(
const chrono::year& __y,
const chrono::month& __m,
2907 const chrono::weekday_last& __wdl) noexcept
2908 : _M_y{__y}, _M_m{__m}, _M_wdl{__wdl}
2911 template<
typename = __detail::__months_years_conversion_disambiguator>
2912 constexpr year_month_weekday_last&
2913 operator+=(
const months& __m)
noexcept
2915 *
this = *
this + __m;
2919 template<
typename = __detail::__months_years_conversion_disambiguator>
2920 constexpr year_month_weekday_last&
2921 operator-=(
const months& __m)
noexcept
2923 *
this = *
this - __m;
2927 constexpr year_month_weekday_last&
2928 operator+=(
const years& __y)
noexcept
2930 *
this = *
this + __y;
2934 constexpr year_month_weekday_last&
2935 operator-=(
const years& __y)
noexcept
2937 *
this = *
this - __y;
2941 constexpr chrono::year
2942 year() const noexcept
2945 constexpr chrono::month
2946 month() const noexcept
2949 constexpr chrono::weekday
2950 weekday() const noexcept
2951 {
return _M_wdl.weekday(); }
2953 constexpr chrono::weekday_last
2954 weekday_last() const noexcept
2958 operator sys_days() const noexcept
2960 const auto __d = sys_days{_M_y / _M_m / last};
2961 return sys_days{(__d - (chrono::weekday{__d}
2962 - _M_wdl.weekday())).time_since_epoch()};
2966 operator local_days() const noexcept
2967 {
return local_days{sys_days{*
this}.time_since_epoch()}; }
2971 {
return _M_y.ok() && _M_m.ok() && _M_wdl.ok(); }
2973 friend constexpr bool
2974 operator==(
const year_month_weekday_last& __x,
2975 const year_month_weekday_last& __y)
noexcept
2977 return __x.year() == __y.year()
2978 && __x.month() == __y.month()
2979 && __x.weekday_last() == __y.weekday_last();
2982 template<
typename = __detail::__months_years_conversion_disambiguator>
2983 friend constexpr year_month_weekday_last
2984 operator+(
const year_month_weekday_last& __ymwdl,
2985 const months& __dm)
noexcept
2987 return ((__ymwdl.year() / __ymwdl.month() + __dm)
2988 / __ymwdl.weekday_last());
2991 template<
typename = __detail::__months_years_conversion_disambiguator>
2992 friend constexpr year_month_weekday_last
2994 const year_month_weekday_last& __ymwdl)
noexcept
2995 {
return __ymwdl + __dm; }
2997 friend constexpr year_month_weekday_last
2998 operator+(
const year_month_weekday_last& __ymwdl,
2999 const years& __dy)
noexcept
3000 {
return {__ymwdl.year() + __dy, __ymwdl.month(), __ymwdl.weekday_last()}; }
3002 friend constexpr year_month_weekday_last
3004 const year_month_weekday_last& __ymwdl)
noexcept
3005 {
return __ymwdl + __dy; }
3007 template<
typename = __detail::__months_years_conversion_disambiguator>
3008 friend constexpr year_month_weekday_last
3009 operator-(
const year_month_weekday_last& __ymwdl,
3010 const months& __dm)
noexcept
3011 {
return __ymwdl + -__dm; }
3013 friend constexpr year_month_weekday_last
3014 operator-(
const year_month_weekday_last& __ymwdl,
3015 const years& __dy)
noexcept
3016 {
return __ymwdl + -__dy; }
3018 friend constexpr year_month_weekday_last
3020 const chrono::weekday_last& __wdl)
noexcept
3021 {
return {__ym.year(), __ym.month(), __wdl}; }
3023 friend constexpr year_month_weekday_last
3025 const chrono::month_weekday_last& __mwdl)
noexcept
3026 {
return {__y, __mwdl.month(), __mwdl.weekday_last()}; }
3028 friend constexpr year_month_weekday_last
3029 operator/(
int __y,
const chrono::month_weekday_last& __mwdl)
noexcept
3030 {
return chrono::year(__y) / __mwdl; }
3032 friend constexpr year_month_weekday_last
3033 operator/(
const chrono::month_weekday_last& __mwdl,
3034 const chrono::year& __y)
noexcept
3035 {
return __y / __mwdl; }
3037 friend constexpr year_month_weekday_last
3038 operator/(
const chrono::month_weekday_last& __mwdl,
int __y)
noexcept
3039 {
return chrono::year(__y) / __mwdl; }
3049 __pow10(
unsigned __n)
3058 template<
typename _Duration>
3062 static constexpr int
3063 _S_fractional_width()
3065 int __multiplicity_2 = 0;
3066 int __multiplicity_5 = 0;
3067 auto __den = _Duration::period::den;
3068 while ((__den % 2) == 0)
3073 while ((__den % 5) == 0)
3081 int __width = (__multiplicity_2 > __multiplicity_5
3082 ? __multiplicity_2 : __multiplicity_5);
3089 hh_mm_ss(_Duration __d,
bool __is_neg)
3090 : _M_is_neg(__is_neg),
3096 if constexpr (treat_as_floating_point_v<typename precision::rep>)
3099 _M_ss = duration_cast<precision>(__ss);
3102 static constexpr _Duration
3103 _S_abs(_Duration __d)
3105 if constexpr (numeric_limits<typename _Duration::rep>::is_signed)
3106 return chrono::abs(__d);
3112 static constexpr unsigned fractional_width = {_S_fractional_width()};
3116 chrono::seconds::rep>,
3117 ratio<1, __detail::__pow10(fractional_width)>>;
3121 : hh_mm_ss{_Duration::zero()}
3125 hh_mm_ss(_Duration __d)
3126 : hh_mm_ss(_S_abs(__d), __d < _Duration::zero())
3130 is_negative() const noexcept
3131 {
return _M_is_neg; }
3133 constexpr chrono::hours
3134 hours() const noexcept
3137 constexpr chrono::minutes
3141 constexpr chrono::seconds
3146 subseconds() const noexcept
3150 operator precision() const noexcept
3151 {
return to_duration(); }
3154 to_duration() const noexcept
3157 return -(_M_h + _M_m + _M_s + _M_ss);
3159 return _M_h + _M_m + _M_s + _M_ss;
3167 chrono::minutes _M_m;
3168 chrono::seconds _M_s;
3176#if __cplusplus > 201103L
3178#define __cpp_lib_chrono_udls 201304
3210#pragma GCC diagnostic push
3211#pragma GCC diagnostic ignored "-Wliteral-suffix"
3213 template<
typename _Dur,
char... _Digits>
3214 constexpr _Dur __check_overflow()
3216 using _Val = __parse_int::_Parse_int<_Digits...>;
3217 constexpr typename _Dur::rep __repval = _Val::value;
3218 static_assert(__repval >= 0 && __repval == _Val::value,
3219 "literal value cannot be represented by duration type");
3220 return _Dur(__repval);
3226 operator""h(
long double __hours)
3230 template <
char... _Digits>
3237 operator""min(
long double __mins)
3241 template <
char... _Digits>
3248 operator""s(
long double __secs)
3252 template <
char... _Digits>
3259 operator""ms(
long double __msecs)
3263 template <
char... _Digits>
3270 operator""us(
long double __usecs)
3274 template <
char... _Digits>
3281 operator""ns(
long double __nsecs)
3285 template <
char... _Digits>
3290#if __cplusplus > 201703L
3291 constexpr chrono::day
3292 operator""d(
unsigned long long __d)
noexcept
3293 {
return chrono::day{
static_cast<unsigned>(__d)}; }
3295 constexpr chrono::year
3296 operator""y(
unsigned long long __y)
noexcept
3297 {
return chrono::year{
static_cast<int>(__y)}; }
3300#pragma GCC diagnostic pop
3307 using namespace literals::chrono_literals;
3310#if __cplusplus > 201703L
3319 is_am(
const hours& __h)
noexcept
3320 {
return 0h <= __h && __h <= 11h; }
3323 is_pm(
const hours& __h)
noexcept
3324 {
return 12h <= __h && __h <= 23h; }
3327 make12(
const hours& __h)
noexcept
3337 make24(
const hours& __h,
bool __is_pm)
noexcept
3358#if __cplusplus >= 201703L
3364 using rep = duration::rep;
3365 using period = duration::period;
3366 using time_point = chrono::time_point<__file_clock>;
3367 static constexpr bool is_steady =
false;
3371 {
return _S_from_sys(chrono::system_clock::now()); }
3373#if __cplusplus > 201703L
3374 template<
typename _Dur>
3376 chrono::file_time<_Dur>
3377 from_sys(
const chrono::sys_time<_Dur>& __t)
noexcept
3378 {
return _S_from_sys(__t); }
3381 template<
typename _Dur>
3383 chrono::sys_time<_Dur>
3384 to_sys(
const chrono::file_time<_Dur>& __t)
noexcept
3385 {
return _S_to_sys(__t); }
3389 using __sys_clock = chrono::system_clock;
3398 template<
typename _Dur>
3400 chrono::time_point<__file_clock, _Dur>
3401 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t)
noexcept
3403 using __file_time = chrono::time_point<__file_clock, _Dur>;
3404 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
3408 template<
typename _Dur>
3410 chrono::time_point<__sys_clock, _Dur>
3411 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t)
noexcept
3413 using __sys_time = chrono::time_point<__sys_clock, _Dur>;
3414 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
3421_GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator==(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t, ratio< 3600 > > hours
hours
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator!=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr duration< __common_rep_t< _Rep2, _Rep1 >, _Period > operator*(const _Rep1 &__s, const duration< _Rep2, _Period > &__d)
duration< int64_t, nano > nanoseconds
nanoseconds
constexpr duration< __common_rep_t< _Rep1, __disable_if_is_duration< _Rep2 > >, _Period > operator%(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
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 forwards by the given duration.
duration< int64_t, ratio< 60 > > minutes
minutes
system_clock high_resolution_clock
Highest-resolution clock.
duration< int64_t, milli > milliseconds
milliseconds
duration< int64_t, micro > microseconds
microseconds
constexpr time_point< _Clock, typename common_type< duration< _Rep1, _Period1 >, _Dur2 >::type > operator+(const duration< _Rep1, _Period1 > &__lhs, const time_point< _Clock, _Dur2 > &__rhs)
Adjust a time point forwards by the given duration.
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator+(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
The sum of two durations.
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t > seconds
seconds
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 bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator-(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
The difference between two durations.
constexpr duration< __common_rep_t< _Rep1, __disable_if_is_duration< _Rep2 > >, _Period > operator/(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
constexpr duration< __common_rep_t< _Rep1, _Rep2 >, _Period > operator*(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration_cast
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
void void_t
A metafunction that always yields void, used for detecting valid types.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
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.
ISO C++ inline namespace for literal suffixes.
ISO C++ 2017 namespace for File System library.
ISO C++ 2011 namespace for date and time utilities.
chrono::duration represents a distance between two points in time
chrono::time_point represents a point in time as measured by a clock
static constexpr int digits
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.