30#ifndef _GLIBCXX_CHRONO_H
31#define _GLIBCXX_CHRONO_H 1
34#pragma GCC system_header
37#if __cplusplus >= 201103L
46#if __cplusplus >= 202002L
53namespace std _GLIBCXX_VISIBILITY(default)
55_GLIBCXX_BEGIN_NAMESPACE_VERSION
57#if __cplusplus >= 201703L && _GLIBCXX_HOSTED
67 template<
typename _Rep,
typename _Period = ratio<1>>
71 template<
typename _Clock,
typename _Dur =
typename _Clock::duration>
83 template<
typename _CT,
typename _Period1,
typename _Period2,
typename =
void>
84 struct __duration_common_type
87 template<
typename _CT,
typename _Period1,
typename _Period2>
88 struct __duration_common_type<_CT, _Period1, _Period2,
89 __void_t<typename _CT::
type>>
92 using __gcd_num = __static_gcd<_Period1::num, _Period2::num>;
93 using __gcd_den = __static_gcd<_Period1::den, _Period2::den>;
94 using __cr =
typename _CT::type;
95 using __r = ratio<__gcd_num::value,
96 (_Period1::den / __gcd_den::value) * _Period2::den>;
99 using type = chrono::duration<__cr, typename __r::type>;
108 template<
typename _Rep1,
typename _Period1,
typename _Rep2,
typename _Period2>
111 : __duration_common_type<common_type<_Rep1, _Rep2>,
112 typename _Period1::type,
113 typename _Period2::type>
117 template<
typename _Rep,
typename _Period>
122 typename _Period::type>;
126 template<
typename _Rep,
typename _Period>
130 typename _Period::type>;
138 template<
typename _CT,
typename _Clock,
typename =
void>
139 struct __timepoint_common_type
142 template<
typename _CT,
typename _Clock>
143 struct __timepoint_common_type<_CT, _Clock, __void_t<typename _CT::type>>
145 using type = chrono::time_point<_Clock, typename _CT::type>;
154 template<
typename _Clock,
typename _Duration1,
typename _Duration2>
157 : __timepoint_common_type<common_type<_Duration1, _Duration2>, _Clock>
161 template<
typename _Clock,
typename _Duration>
167 template<
typename _Clock,
typename _Duration>
182 template<
typename _ToDur,
typename _CF,
typename _CR,
183 bool _NumIsOne =
false,
bool _DenIsOne =
false>
184 struct __duration_cast_impl
186 template<
typename _Rep,
typename _Period>
187 static constexpr _ToDur
188 __cast(
const duration<_Rep, _Period>& __d)
190 typedef typename _ToDur::rep __to_rep;
191 return _ToDur(
static_cast<__to_rep
>(
static_cast<_CR
>(__d.count())
192 *
static_cast<_CR
>(_CF::num)
193 /
static_cast<_CR
>(_CF::den)));
197 template<
typename _ToDur,
typename _CF,
typename _CR>
198 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
200 template<
typename _Rep,
typename _Period>
201 static constexpr _ToDur
202 __cast(
const duration<_Rep, _Period>& __d)
204 typedef typename _ToDur::rep __to_rep;
205 return _ToDur(
static_cast<__to_rep
>(__d.count()));
209 template<
typename _ToDur,
typename _CF,
typename _CR>
210 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
212 template<
typename _Rep,
typename _Period>
213 static constexpr _ToDur
214 __cast(
const duration<_Rep, _Period>& __d)
216 typedef typename _ToDur::rep __to_rep;
217 return _ToDur(
static_cast<__to_rep
>(
218 static_cast<_CR
>(__d.count()) /
static_cast<_CR
>(_CF::den)));
222 template<
typename _ToDur,
typename _CF,
typename _CR>
223 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
225 template<
typename _Rep,
typename _Period>
226 static constexpr _ToDur
227 __cast(
const duration<_Rep, _Period>& __d)
229 typedef typename _ToDur::rep __to_rep;
230 return _ToDur(
static_cast<__to_rep
>(
231 static_cast<_CR
>(__d.count()) *
static_cast<_CR
>(_CF::num)));
235 template<
typename _Tp>
240 template<
typename _Rep,
typename _Period>
241 struct __is_duration<
duration<_Rep, _Period>>
245 template<
typename _Tp>
246 using __enable_if_is_duration
247 =
typename enable_if<__is_duration<_Tp>::value, _Tp>::type;
249 template<
typename _Tp>
250 using __disable_if_is_duration
251 =
typename enable_if<!__is_duration<_Tp>::value, _Tp>::type;
253#if __cplusplus >= 201703L
254 template<
typename _Tp>
255 inline constexpr bool __is_duration_v =
false;
256 template<
typename _Rep,
typename _Period>
257 inline constexpr bool __is_duration_v<duration<_Rep, _Period>> =
true;
258 template<
typename _Tp>
259 inline constexpr bool __is_time_point_v =
false;
260 template<
typename _Clock,
typename _Dur>
261 inline constexpr bool __is_time_point_v<time_point<_Clock, _Dur>> =
true;
276 template<
typename _ToDur,
typename _Rep,
typename _Period>
278 constexpr __enable_if_is_duration<_ToDur>
281#if __cpp_inline_variables && __cpp_if_constexpr
282 if constexpr (is_same_v<_ToDur, duration<_Rep, _Period>>)
287 using __to_period =
typename _ToDur::period;
288 using __to_rep =
typename _ToDur::rep;
291 using __dc = __duration_cast_impl<_ToDur, __cf, __cr,
292 __cf::num == 1, __cf::den == 1>;
293 return __dc::__cast(__d);
294#if __cpp_inline_variables && __cpp_if_constexpr
310 template<
typename _Rep>
315#if __cplusplus > 201402L
316 template <
typename _Rep>
317 inline constexpr bool treat_as_floating_point_v =
321 inline constexpr bool treat_as_floating_point_v<int> =
false;
323 inline constexpr bool treat_as_floating_point_v<long> =
false;
325 inline constexpr bool treat_as_floating_point_v<long long> =
false;
327 inline constexpr bool treat_as_floating_point_v<float> =
true;
329 inline constexpr bool treat_as_floating_point_v<double> =
true;
331 inline constexpr bool treat_as_floating_point_v<long double> =
true;
334#if __cplusplus > 201703L
335#if __cpp_lib_concepts
336 template<
typename _Tp>
337 inline constexpr bool is_clock_v =
false;
339 template<
typename _Tp>
342 typename _Tp::period;
343 typename _Tp::duration;
344 typename _Tp::time_point::clock;
345 typename _Tp::time_point::duration;
346 { &_Tp::is_steady } -> same_as<const bool*>;
347 { _Tp::now() } -> same_as<typename _Tp::time_point>;
348 requires same_as<
typename _Tp::duration,
349 duration<typename _Tp::rep, typename _Tp::period>>;
350 requires same_as<
typename _Tp::time_point::duration,
351 typename _Tp::duration>;
353 inline constexpr bool is_clock_v<_Tp> =
true;
355 template<
typename _Tp,
typename =
void>
356 inline constexpr bool is_clock_v =
false;
358 template<
typename _Tp>
359 inline constexpr bool
360 is_clock_v<_Tp,
void_t<
typename _Tp::rep,
typename _Tp::period,
361 typename _Tp::duration,
362 typename _Tp::time_point::duration,
363 decltype(_Tp::is_steady),
364 decltype(_Tp::now())>>
365 = __and_v<is_same<
typename _Tp::duration,
367 is_same<
typename _Tp::time_point::duration,
368 typename _Tp::duration>,
369 is_same<
decltype(&_Tp::is_steady),
const bool*>,
370 is_same<
decltype(_Tp::now()),
typename _Tp::time_point>>;
373 template<
typename _Tp>
375 : bool_constant<is_clock_v<_Tp>>
379#if __cplusplus >= 201703L
390 template<
typename _ToDur,
typename _Rep,
typename _Period>
391 [[nodiscard]]
constexpr __enable_if_is_duration<_ToDur>
396 return __to - _ToDur{1};
410 template<
typename _ToDur,
typename _Rep,
typename _Period>
411 [[nodiscard]]
constexpr __enable_if_is_duration<_ToDur>
416 return __to + _ToDur{1};
431 template <
typename _ToDur,
typename _Rep,
typename _Period>
432 [[nodiscard]]
constexpr
434 __and_<__is_duration<_ToDur>,
435 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
440 _ToDur __t1 = __t0 + _ToDur{1};
441 auto __diff0 = __d - __t0;
442 auto __diff1 = __t1 - __d;
443 if (__diff0 == __diff1)
445 if (__t0.count() & 1)
449 else if (__diff0 < __diff1)
460 template<
typename _Rep,
typename _Period>
461 [[nodiscard]]
constexpr
465 if (__d >= __d.zero())
480 template<
typename _Tp,
typename _Up>
482 __ceil_impl(
const _Tp& __t,
const _Up& __u)
484 return (__t < __u) ? (__t + _Tp{1}) : __t;
488 template<
typename _ToDur,
typename _Rep,
typename _Period>
490 ceil(
const duration<_Rep, _Period>& __d)
498 template<
typename _Rep>
501 static constexpr _Rep
505 static constexpr _Rep
509 static constexpr _Rep
514 template<
typename _Rep,
typename _Period>
517 static_assert(!__is_duration<_Rep>::value,
518 "rep cannot be a std::chrono::duration");
519 static_assert(__is_ratio<_Period>::value,
520 "period must be a specialization of std::ratio");
521 static_assert(_Period::num > 0,
"period must be positive");
523 template<
typename _Rep2>
526 static constexpr intmax_t
527 _S_gcd(intmax_t __m, intmax_t __n)
noexcept
531#if __cplusplus >= 201402L
534 intmax_t __rem = __m % __n;
543 return (__n == 0) ? __m : _S_gcd(__n, __m % __n);
551 template<
typename _R1,
typename _R2,
552 intmax_t __gcd1 = _S_gcd(_R1::num, _R2::num),
553 intmax_t __gcd2 = _S_gcd(_R1::den, _R2::den)>
554 using __divide =
ratio<(_R1::num / __gcd1) * (_R2::den / __gcd2),
555 (_R1::den / __gcd2) * (_R2::num / __gcd1)>;
558 template<
typename _Period2>
560 = __bool_constant<__divide<_Period2, _Period>::den == 1>;
565 using period =
typename _Period::type;
568 constexpr duration() =
default;
570 duration(
const duration&) =
default;
574 template<
typename _Rep2,
typename = _Require<
575 is_convertible<const _Rep2&, rep>,
576 __or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>>
577 constexpr explicit duration(
const _Rep2& __rep)
578 : __r(
static_cast<rep
>(__rep)) { }
580 template<
typename _Rep2,
typename _Period2,
typename = _Require<
581 is_convertible<const _Rep2&, rep>,
582 __or_<__is_float<rep>,
583 __and_<__is_harmonic<_Period2>,
584 __not_<__is_float<_Rep2>>>>>>
585 constexpr duration(
const duration<_Rep2, _Period2>& __d)
588 ~duration() =
default;
589 duration& operator=(
const duration&) =
default;
598 constexpr duration<typename common_type<rep>::type, period>
600 {
return duration<typename common_type<rep>::type, period>(__r); }
602 constexpr duration<typename common_type<rep>::type, period>
604 {
return duration<typename common_type<rep>::type, period>(-__r); }
606 _GLIBCXX17_CONSTEXPR duration&
613 _GLIBCXX17_CONSTEXPR duration
615 {
return duration(__r++); }
617 _GLIBCXX17_CONSTEXPR duration&
624 _GLIBCXX17_CONSTEXPR duration
626 {
return duration(__r--); }
628 _GLIBCXX17_CONSTEXPR duration&
629 operator+=(
const duration& __d)
635 _GLIBCXX17_CONSTEXPR duration&
636 operator-=(
const duration& __d)
642 _GLIBCXX17_CONSTEXPR duration&
643 operator*=(
const rep& __rhs)
649 _GLIBCXX17_CONSTEXPR duration&
650 operator/=(
const rep& __rhs)
657 template<
typename _Rep2 = rep>
659 __enable_if_t<!treat_as_floating_point<_Rep2>::value, duration&>
660 operator%=(
const rep& __rhs)
666 template<
typename _Rep2 = rep>
668 __enable_if_t<!treat_as_floating_point<_Rep2>::value, duration&>
669 operator%=(
const duration& __d)
676 static constexpr duration
678 {
return duration(duration_values<rep>::zero()); }
680 static constexpr duration
682 {
return duration(duration_values<rep>::min()); }
684 static constexpr duration
686 {
return duration(duration_values<rep>::max()); }
696 template<
typename _Rep1,
typename _Period1,
697 typename _Rep2,
typename _Period2>
701 const duration<_Rep2, _Period2>& __rhs)
703 typedef duration<_Rep1, _Period1> __dur1;
704 typedef duration<_Rep2, _Period2> __dur2;
706 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
710 template<
typename _Rep1,
typename _Period1,
711 typename _Rep2,
typename _Period2>
720 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
731 template<
typename _Rep1,
typename _Rep2,
733 using __common_rep_t =
typename
743 template<
typename _Rep1,
typename _Period,
typename _Rep2>
744 constexpr duration<__common_rep_t<_Rep1, _Rep2>, _Period>
745 operator*(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
747 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
749 return __cd(__cd(__d).count() * __s);
752 template<
typename _Rep1,
typename _Rep2,
typename _Period>
755 {
return __d * __s; }
757 template<
typename _Rep1,
typename _Period,
typename _Rep2>
759 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
764 return __cd(__cd(__d).count() / __s);
767 template<
typename _Rep1,
typename _Period1,
768 typename _Rep2,
typename _Period2>
776 return __cd(__lhs).count() / __cd(__rhs).count();
780 template<
typename _Rep1,
typename _Period,
typename _Rep2>
782 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
787 return __cd(__cd(__d).count() % __s);
790 template<
typename _Rep1,
typename _Period1,
791 typename _Rep2,
typename _Period2>
793 duration<_Rep2, _Period2>>
::type
800 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
811 template<
typename _Rep1,
typename _Period1,
812 typename _Rep2,
typename _Period2>
815 const duration<_Rep2, _Period2>& __rhs)
817 typedef duration<_Rep1, _Period1> __dur1;
818 typedef duration<_Rep2, _Period2> __dur2;
820 return __ct(__lhs).count() == __ct(__rhs).count();
823 template<
typename _Rep1,
typename _Period1,
824 typename _Rep2,
typename _Period2>
832 return __ct(__lhs).count() < __ct(__rhs).count();
835#if __cpp_lib_three_way_comparison
836 template<
typename _Rep1,
typename _Period1,
837 typename _Rep2,
typename _Period2>
838 requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
845 return __ct(__lhs).count() <=> __ct(__rhs).count();
848 template<
typename _Rep1,
typename _Period1,
849 typename _Rep2,
typename _Period2>
851 operator!=(
const duration<_Rep1, _Period1>& __lhs,
852 const duration<_Rep2, _Period2>& __rhs)
853 {
return !(__lhs == __rhs); }
856 template<
typename _Rep1,
typename _Period1,
857 typename _Rep2,
typename _Period2>
861 {
return !(__rhs < __lhs); }
863 template<
typename _Rep1,
typename _Period1,
864 typename _Rep2,
typename _Period2>
868 {
return __rhs < __lhs; }
870 template<
typename _Rep1,
typename _Period1,
871 typename _Rep2,
typename _Period2>
875 {
return !(__lhs < __rhs); }
880#ifdef _GLIBCXX_USE_C99_STDINT
881# define _GLIBCXX_CHRONO_INT64_T int64_t
882#elif defined __INT64_TYPE__
883# define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__
886 "Representation type for nanoseconds must have at least 64 bits");
887# define _GLIBCXX_CHRONO_INT64_T long long
909#if __cplusplus > 201703L
923#undef _GLIBCXX_CHRONO_INT64_T
925 template<
typename _Clock,
typename _Dur>
928 static_assert(__is_duration<_Dur>::value,
929 "duration must be a specialization of std::chrono::duration");
932 typedef _Clock clock;
933 typedef _Dur duration;
934 typedef typename duration::rep rep;
935 typedef typename duration::period period;
937 constexpr time_point() : __d(duration::zero())
940 constexpr explicit time_point(
const duration& __dur)
945 template<
typename _Dur2,
946 typename = _Require<is_convertible<_Dur2, _Dur>>>
947 constexpr time_point(
const time_point<clock, _Dur2>& __t)
948 : __d(__t.time_since_epoch())
953 time_since_epoch()
const
956#if __cplusplus > 201703L
957 constexpr time_point&
966 {
return time_point{__d++}; }
968 constexpr time_point&
977 {
return time_point{__d--}; }
981 _GLIBCXX17_CONSTEXPR time_point&
982 operator+=(
const duration& __dur)
988 _GLIBCXX17_CONSTEXPR time_point&
989 operator-=(
const duration& __dur)
996 static constexpr time_point
998 {
return time_point(duration::min()); }
1000 static constexpr time_point
1002 {
return time_point(duration::max()); }
1020 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1021 _GLIBCXX_NODISCARD
constexpr
1029#if __cplusplus > 201402L
1042 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1043 [[nodiscard]]
constexpr
1063 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1064 [[nodiscard]]
constexpr
1085 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1086 [[nodiscard]]
constexpr
1088 && !treat_as_floating_point_v<typename _ToDur::rep>,
1089 time_point<_Clock, _ToDur>>
1101 template<
typename _Clock,
typename _Dur1,
1102 typename _Rep2,
typename _Period2>
1103 constexpr time_point<_Clock,
1106 const duration<_Rep2, _Period2>& __rhs)
1108 typedef duration<_Rep2, _Period2> __dur2;
1110 typedef time_point<_Clock, __ct> __time_point;
1111 return __time_point(__lhs.time_since_epoch() + __rhs);
1115 template<
typename _Rep1,
typename _Period1,
1116 typename _Clock,
typename _Dur2>
1125 return __time_point(__rhs.time_since_epoch() + __lhs);
1129 template<
typename _Clock,
typename _Dur1,
1130 typename _Rep2,
typename _Period2>
1131 constexpr time_point<_Clock,
1139 return __time_point(__lhs.time_since_epoch() -__rhs);
1143 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1147 {
return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
1155 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1157 operator==(
const time_point<_Clock, _Dur1>& __lhs,
1158 const time_point<_Clock, _Dur2>& __rhs)
1159 {
return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
1161#if __cpp_lib_three_way_comparison
1162 template<
typename _Clock,
typename _Dur1,
1163 three_way_comparable_with<_Dur1> _Dur2>
1165 operator<=>(
const time_point<_Clock, _Dur1>& __lhs,
1166 const time_point<_Clock, _Dur2>& __rhs)
1167 {
return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); }
1169 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1173 {
return !(__lhs == __rhs); }
1176 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1180 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
1182 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1186 {
return !(__rhs < __lhs); }
1188 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1192 {
return __rhs < __lhs; }
1194 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1198 {
return !(__lhs < __rhs); }
1222_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
1233 typedef duration::rep rep;
1234 typedef duration::period period;
1237 static_assert(system_clock::duration::min()
1238 < system_clock::duration::zero(),
1239 "a clock's minimum duration cannot be less than its epoch");
1241 static constexpr bool is_steady =
false;
1247 [[__gnu__::__always_inline__]]
1249 to_time_t(
const time_point& __t)
noexcept
1252 (__t.time_since_epoch()).count());
1255 [[__gnu__::__always_inline__]]
1257 from_time_t(std::time_t __t)
noexcept
1275 typedef duration::rep rep;
1276 typedef duration::period period;
1279 static constexpr bool is_steady =
true;
1296_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
1298#if __cplusplus >= 202002L
1301 template<
typename _Duration>
1303 using sys_seconds = sys_time<seconds>;
1304 using sys_days = sys_time<days>;
1306 using file_clock = ::std::filesystem::__file_clock;
1308 template<
typename _Duration>
1312 template<>
struct is_clock<steady_clock> :
true_type { };
1313 template<>
struct is_clock<file_clock> : true_type { };
1315 template<>
inline constexpr bool is_clock_v<system_clock> =
true;
1316 template<>
inline constexpr bool is_clock_v<steady_clock> =
true;
1317 template<>
inline constexpr bool is_clock_v<file_clock> =
true;
1320#elif __cplusplus >= 202002L
1324 template<
typename _Duration>
1326 using sys_seconds = sys_time<seconds>;
1327 using sys_days = sys_time<days>;
1331#ifdef __glibcxx_chrono_udls
1363#pragma GCC diagnostic push
1364#pragma GCC diagnostic ignored "-Wliteral-suffix"
1366 template<
typename _Dur,
char... _Digits>
1367 constexpr _Dur __check_overflow()
1369 using _Val = __parse_int::_Parse_int<_Digits...>;
1370 constexpr typename _Dur::rep __repval = _Val::value;
1371 static_assert(__repval >= 0 && __repval == _Val::value,
1372 "literal value cannot be represented by duration type");
1373 return _Dur(__repval);
1378 constexpr chrono::duration<long double, ratio<3600,1>>
1379 operator""h(
long double __hours)
1383 template <
char... _Digits>
1390 operator""min(
long double __mins)
1394 template <
char... _Digits>
1401 operator""s(
long double __secs)
1405 template <
char... _Digits>
1412 operator""ms(
long double __msecs)
1416 template <
char... _Digits>
1423 operator""us(
long double __usecs)
1427 template <
char... _Digits>
1434 operator""ns(
long double __nsecs)
1438 template <
char... _Digits>
1443#pragma GCC diagnostic pop
1450 using namespace literals::chrono_literals;
1454#if __cplusplus >= 201703L && _GLIBCXX_HOSTED
1460 using rep = duration::rep;
1461 using period = duration::period;
1462 using time_point = chrono::time_point<__file_clock>;
1463 static constexpr bool is_steady =
false;
1467 {
return _S_from_sys(chrono::system_clock::now()); }
1469#if __cplusplus > 201703L
1470 template<
typename _Dur>
1472 chrono::file_time<common_type_t<_Dur, chrono::seconds>>
1473 from_sys(
const chrono::sys_time<_Dur>& __t)
noexcept
1474 {
return _S_from_sys(__t); }
1477 template<
typename _Dur>
1479 chrono::sys_time<common_type_t<_Dur, chrono::seconds>>
1480 to_sys(
const chrono::file_time<_Dur>& __t)
noexcept
1481 {
return _S_to_sys(__t); }
1485 using __sys_clock = chrono::system_clock;
1494 template<
typename _Dur>
1496 chrono::time_point<__file_clock, common_type_t<_Dur, chrono::seconds>>
1497 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t)
noexcept
1500 using __file_time = chrono::time_point<__file_clock, _CDur>;
1501 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
1505 template<
typename _Dur>
1507 chrono::time_point<__sys_clock, common_type_t<_Dur, chrono::seconds>>
1508 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t)
noexcept
1511 using __sys_time = chrono::time_point<__sys_clock, _CDur>;
1512 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
1518_GLIBCXX_END_NAMESPACE_VERSION
constexpr __enable_if_is_duration< _ToDur > ceil(const duration< _Rep, _Period > &__d)
constexpr bool operator==(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t, ratio< 604800 > > weeks
weeks
constexpr __enable_if_is_duration< _ToDur > floor(const duration< _Rep, _Period > &__d)
duration< int64_t, ratio< 2629746 > > months
months
constexpr enable_if_t< __and_< __is_duration< _ToDur >, __not_< treat_as_floating_point< typename _ToDur::rep > > >::value, _ToDur > round(const duration< _Rep, _Period > &__d)
duration< int64_t, ratio< 86400 > > days
days
duration< int64_t, ratio< 31556952 > > years
years
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)
system_clock high_resolution_clock
Highest-resolution clock.
constexpr duration< __common_rep_t< _Rep2, _Rep1 >, _Period > operator*(const _Rep1 &__s, const duration< _Rep2, _Period > &__d)
duration< int64_t, nano > nanoseconds
nanoseconds
constexpr enable_if_t< numeric_limits< _Rep >::is_signed, duration< _Rep, _Period > > abs(duration< _Rep, _Period > __d)
constexpr duration< __common_rep_t< _Rep1, __disable_if_is_duration< _Rep2 > >, _Period > operator%(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
constexpr time_point< local_t, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator+(const time_point< local_t, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
duration< int64_t, ratio< 60 > > minutes
minutes
constexpr __enable_if_t< __is_duration< _ToDur >::value, time_point< _Clock, _ToDur > > time_point_cast(const time_point< _Clock, _Dur > &__t)
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 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 > ceil(const duration< _Rep, _Period > &__d)
constexpr auto operator<=>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
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.
ISO C++ entities toplevel namespace is std.
ISO C++ inline namespace for literal suffixes.
Implementation details not part of the namespace std interface.
ISO C++ 2011 namespace for date and time utilities.
ISO C++ 2017 namespace for File System library.
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.
chrono::duration represents a distance between two points in time
chrono::time_point represents a point in time as measured by a clock