30 #ifndef _GLIBCXX_CHRONO_H 31 #define _GLIBCXX_CHRONO_H 1 33 #pragma GCC system_header 35 #if __cplusplus >= 201103L 42 #if __cplusplus >= 202002L 47 namespace std _GLIBCXX_VISIBILITY(default)
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
51 #if __cplusplus >= 201703L 52 namespace filesystem {
struct __file_clock; };
61 template<
typename _Rep,
typename _Period = ratio<1>>
65 template<
typename _Clock,
typename _Dur =
typename _Clock::duration>
77 template<
typename _CT,
typename _Period1,
typename _Period2,
typename =
void>
78 struct __duration_common_type
81 template<
typename _CT,
typename _Period1,
typename _Period2>
82 struct __duration_common_type<_CT, _Period1, _Period2,
83 __void_t<typename _CT::type>>
86 using __gcd_num = __static_gcd<_Period1::num, _Period2::num>;
87 using __gcd_den = __static_gcd<_Period1::den, _Period2::den>;
88 using __cr =
typename _CT::type;
89 using __r =
ratio<__gcd_num::value,
90 (_Period1::den / __gcd_den::value) * _Period2::den>;
102 template<
typename _Rep1,
typename _Period1,
typename _Rep2,
typename _Period2>
105 : __duration_common_type<common_type<_Rep1, _Rep2>,
106 typename _Period1::type,
107 typename _Period2::type>
111 template<
typename _Rep,
typename _Period>
116 typename _Period::type>;
120 template<
typename _Rep,
typename _Period>
124 typename _Period::type>;
132 template<
typename _CT,
typename _Clock,
typename =
void>
133 struct __timepoint_common_type
136 template<
typename _CT,
typename _Clock>
137 struct __timepoint_common_type<_CT, _Clock, __void_t<typename _CT::type>>
139 using type = chrono::time_point<_Clock, typename _CT::type>;
148 template<
typename _Clock,
typename _Duration1,
typename _Duration2>
151 : __timepoint_common_type<common_type<_Duration1, _Duration2>, _Clock>
155 template<
typename _Clock,
typename _Duration>
161 template<
typename _Clock,
typename _Duration>
176 template<
typename _ToDur,
typename _CF,
typename _CR,
177 bool _NumIsOne =
false,
bool _DenIsOne =
false>
178 struct __duration_cast_impl
180 template<
typename _Rep,
typename _Period>
181 static constexpr _ToDur
182 __cast(
const duration<_Rep, _Period>& __d)
184 typedef typename _ToDur::rep __to_rep;
185 return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
186 * static_cast<_CR>(_CF::num)
187 /
static_cast<_CR
>(_CF::den)));
191 template<
typename _ToDur,
typename _CF,
typename _CR>
192 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
194 template<
typename _Rep,
typename _Period>
195 static constexpr _ToDur
196 __cast(
const duration<_Rep, _Period>& __d)
198 typedef typename _ToDur::rep __to_rep;
199 return _ToDur(static_cast<__to_rep>(__d.count()));
203 template<
typename _ToDur,
typename _CF,
typename _CR>
204 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
206 template<
typename _Rep,
typename _Period>
207 static constexpr _ToDur
208 __cast(
const duration<_Rep, _Period>& __d)
210 typedef typename _ToDur::rep __to_rep;
211 return _ToDur(static_cast<__to_rep>(
212 static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
216 template<
typename _ToDur,
typename _CF,
typename _CR>
217 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
219 template<
typename _Rep,
typename _Period>
220 static constexpr _ToDur
221 __cast(
const duration<_Rep, _Period>& __d)
223 typedef typename _ToDur::rep __to_rep;
224 return _ToDur(static_cast<__to_rep>(
225 static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
229 template<
typename _Tp>
234 template<
typename _Rep,
typename _Period>
235 struct __is_duration<duration<_Rep, _Period>>
239 template<
typename _Tp>
240 using __enable_if_is_duration
241 =
typename enable_if<__is_duration<_Tp>::value, _Tp>::type;
243 template<
typename _Tp>
244 using __disable_if_is_duration
245 =
typename enable_if<!__is_duration<_Tp>::value, _Tp>::type;
247 #if __cplusplus >= 201703L 248 template<
typename _Tp>
249 inline constexpr
bool __is_duration_v =
false;
250 template<
typename _Rep,
typename _Period>
251 inline constexpr
bool __is_duration_v<duration<_Rep, _Period>> =
true;
252 template<
typename _Tp>
253 inline constexpr
bool __is_time_point_v =
false;
254 template<
typename _Clock,
typename _Dur>
255 inline constexpr
bool __is_time_point_v<time_point<_Clock, _Dur>> =
true;
270 template<
typename _ToDur,
typename _Rep,
typename _Period>
272 constexpr __enable_if_is_duration<_ToDur>
275 #if __cpp_inline_variables && __cpp_if_constexpr 281 using __to_period =
typename _ToDur::period;
282 using __to_rep =
typename _ToDur::rep;
285 using __dc = __duration_cast_impl<_ToDur, __cf, __cr,
286 __cf::num == 1, __cf::den == 1>;
287 return __dc::__cast(__d);
288 #if __cpp_inline_variables && __cpp_if_constexpr 304 template<
typename _Rep>
309 #if __cplusplus > 201402L 310 template <
typename _Rep>
311 inline constexpr
bool treat_as_floating_point_v =
315 inline constexpr
bool treat_as_floating_point_v<int> =
false;
317 inline constexpr
bool treat_as_floating_point_v<long> =
false;
319 inline constexpr
bool treat_as_floating_point_v<long long> =
false;
321 inline constexpr
bool treat_as_floating_point_v<float> =
true;
323 inline constexpr
bool treat_as_floating_point_v<double> =
true;
325 inline constexpr
bool treat_as_floating_point_v<long double> =
true;
328 #if __cplusplus > 201703L 329 #if __cpp_lib_concepts 330 template<
typename _Tp>
331 inline constexpr
bool is_clock_v =
false;
333 template<
typename _Tp>
336 typename _Tp::period;
337 typename _Tp::duration;
338 typename _Tp::time_point::clock;
339 typename _Tp::time_point::duration;
340 { &_Tp::is_steady } -> same_as<const bool*>;
341 { _Tp::now() } -> same_as<typename _Tp::time_point>;
342 requires
same_as<
typename _Tp::duration,
343 duration<typename _Tp::rep, typename _Tp::period>>;
344 requires
same_as<
typename _Tp::time_point::duration,
345 typename _Tp::duration>;
347 inline constexpr
bool is_clock_v<_Tp> =
true;
349 template<
typename _Tp,
typename =
void>
350 inline constexpr
bool is_clock_v =
false;
352 template<
typename _Tp>
353 inline constexpr
bool 354 is_clock_v<_Tp,
void_t<
typename _Tp::rep,
typename _Tp::period,
355 typename _Tp::duration,
356 typename _Tp::time_point::duration,
357 decltype(_Tp::is_steady),
358 decltype(_Tp::now())>>
359 = __and_v<is_same<
typename _Tp::duration,
360 duration<typename _Tp::rep, typename _Tp::period>>,
361 is_same<
typename _Tp::time_point::duration,
362 typename _Tp::duration>,
363 is_same<decltype(&_Tp::is_steady), const bool*>,
364 is_same<decltype(_Tp::now()), typename _Tp::time_point>>;
367 template<
typename _Tp>
373 #if __cplusplus >= 201703L 374 # define __cpp_lib_chrono 201611L 386 template<
typename _ToDur,
typename _Rep,
typename _Period>
387 [[nodiscard]] constexpr __enable_if_is_duration<_ToDur>
392 return __to - _ToDur{1};
406 template<
typename _ToDur,
typename _Rep,
typename _Period>
407 [[nodiscard]] constexpr __enable_if_is_duration<_ToDur>
412 return __to + _ToDur{1};
427 template <
typename _ToDur,
typename _Rep,
typename _Period>
428 [[nodiscard]] constexpr
430 __and_<__is_duration<_ToDur>,
431 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
435 _ToDur __t0 = chrono::floor<_ToDur>(__d);
436 _ToDur __t1 = __t0 + _ToDur{1};
437 auto __diff0 = __d - __t0;
438 auto __diff1 = __t1 - __d;
439 if (__diff0 == __diff1)
441 if (__t0.count() & 1)
445 else if (__diff0 < __diff1)
456 template<
typename _Rep,
typename _Period>
457 [[nodiscard]] constexpr
461 if (__d >= __d.zero())
476 template<
typename _Tp,
typename _Up>
478 __ceil_impl(
const _Tp& __t,
const _Up& __u)
480 return (__t < __u) ? (__t + _Tp{1}) : __t;
484 template<
typename _ToDur,
typename _Rep,
typename _Period>
486 ceil(
const duration<_Rep, _Period>& __d)
488 return __detail::__ceil_impl(chrono::duration_cast<_ToDur>(__d), __d);
494 template<
typename _Rep>
497 static constexpr _Rep
501 static constexpr _Rep
505 static constexpr _Rep
510 template<
typename _Rep,
typename _Period>
513 static_assert(!__is_duration<_Rep>::value,
514 "rep cannot be a std::chrono::duration");
515 static_assert(__is_ratio<_Period>::value,
516 "period must be a specialization of std::ratio");
517 static_assert(_Period::num > 0,
"period must be positive");
519 template<
typename _Rep2>
522 static constexpr intmax_t
523 _S_gcd(intmax_t __m, intmax_t __n) noexcept
527 #if __cplusplus >= 201402L 530 intmax_t __rem = __m % __n;
539 return (__n == 0) ? __m : _S_gcd(__n, __m % __n);
547 template<
typename _R1,
typename _R2,
548 intmax_t __gcd1 = _S_gcd(_R1::num, _R2::num),
549 intmax_t __gcd2 = _S_gcd(_R1::den, _R2::den)>
550 using __divide = ratio<(_R1::num / __gcd1) * (_R2::den / __gcd2),
551 (_R1::den / __gcd2) * (_R2::num / __gcd1)>;
554 template<
typename _Period2>
556 = __bool_constant<__divide<_Period2, _Period>::den == 1>;
561 using period =
typename _Period::type;
564 constexpr duration() =
default;
566 duration(
const duration&) =
default;
570 template<
typename _Rep2,
typename = _Require<
571 is_convertible<const _Rep2&, rep>,
572 __or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>>
573 constexpr
explicit duration(
const _Rep2& __rep)
574 : __r(static_cast<rep>(__rep)) { }
576 template<
typename _Rep2,
typename _Period2,
typename = _Require<
577 is_convertible<const _Rep2&, rep>,
578 __or_<__is_float<rep>,
579 __and_<__is_harmonic<_Period2>,
580 __not_<__is_float<_Rep2>>>>>>
581 constexpr duration(
const duration<_Rep2, _Period2>& __d)
584 ~duration() =
default;
585 duration& operator=(
const duration&) =
default;
594 constexpr duration<typename common_type<rep>::type, period>
596 {
return duration<typename common_type<rep>::type, period>(__r); }
598 constexpr duration<typename common_type<rep>::type, period>
600 {
return duration<typename common_type<rep>::type, period>(-__r); }
602 _GLIBCXX17_CONSTEXPR duration&
609 _GLIBCXX17_CONSTEXPR duration
611 {
return duration(__r++); }
613 _GLIBCXX17_CONSTEXPR duration&
620 _GLIBCXX17_CONSTEXPR duration
622 {
return duration(__r--); }
624 _GLIBCXX17_CONSTEXPR duration&
625 operator+=(
const duration& __d)
631 _GLIBCXX17_CONSTEXPR duration&
632 operator-=(
const duration& __d)
638 _GLIBCXX17_CONSTEXPR duration&
639 operator*=(
const rep& __rhs)
645 _GLIBCXX17_CONSTEXPR duration&
646 operator/=(
const rep& __rhs)
653 template<
typename _Rep2 = rep>
655 __enable_if_t<!treat_as_floating_point<_Rep2>::value, duration&>
656 operator%=(
const rep& __rhs)
662 template<
typename _Rep2 = rep>
664 __enable_if_t<!treat_as_floating_point<_Rep2>::value, duration&>
665 operator%=(
const duration& __d)
672 static constexpr duration
674 {
return duration(duration_values<rep>::zero()); }
676 static constexpr duration
678 {
return duration(duration_values<rep>::min()); }
680 static constexpr duration
682 {
return duration(duration_values<rep>::max()); }
692 template<
typename _Rep1,
typename _Period1,
693 typename _Rep2,
typename _Period2>
694 constexpr
typename common_type<duration<_Rep1, _Period1>,
695 duration<_Rep2, _Period2>>::type
702 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
706 template<
typename _Rep1,
typename _Period1,
707 typename _Rep2,
typename _Period2>
716 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
727 template<
typename _Rep1,
typename _Rep2,
729 using __common_rep_t =
typename 739 template<
typename _Rep1,
typename _Period,
typename _Rep2>
740 constexpr duration<__common_rep_t<_Rep1, _Rep2>, _Period>
745 return __cd(__cd(__d).count() * __s);
748 template<
typename _Rep1,
typename _Rep2,
typename _Period>
751 {
return __d * __s; }
753 template<
typename _Rep1,
typename _Period,
typename _Rep2>
755 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
760 return __cd(__cd(__d).count() / __s);
763 template<
typename _Rep1,
typename _Period1,
764 typename _Rep2,
typename _Period2>
772 return __cd(__lhs).count() / __cd(__rhs).count();
776 template<
typename _Rep1,
typename _Period,
typename _Rep2>
778 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
783 return __cd(__cd(__d).count() % __s);
786 template<
typename _Rep1,
typename _Period1,
787 typename _Rep2,
typename _Period2>
789 duration<_Rep2, _Period2>>::type
796 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
807 template<
typename _Rep1,
typename _Period1,
808 typename _Rep2,
typename _Period2>
816 return __ct(__lhs).count() == __ct(__rhs).count();
819 template<
typename _Rep1,
typename _Period1,
820 typename _Rep2,
typename _Period2>
822 operator<(const duration<_Rep1, _Period1>& __lhs,
828 return __ct(__lhs).count() < __ct(__rhs).count();
831 #if __cpp_lib_three_way_comparison 832 template<
typename _Rep1,
typename _Period1,
833 typename _Rep2,
typename _Period2>
834 requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
836 operator<=>(
const duration<_Rep1, _Period1>& __lhs,
837 const duration<_Rep2, _Period2>& __rhs)
840 duration<_Rep2, _Period2>>;
841 return __ct(__lhs).count() <=> __ct(__rhs).count();
844 template<
typename _Rep1,
typename _Period1,
845 typename _Rep2,
typename _Period2>
849 {
return !(__lhs == __rhs); }
852 template<
typename _Rep1,
typename _Period1,
853 typename _Rep2,
typename _Period2>
855 operator<=(const duration<_Rep1, _Period1>& __lhs,
857 {
return !(__rhs < __lhs); }
859 template<
typename _Rep1,
typename _Period1,
860 typename _Rep2,
typename _Period2>
864 {
return __rhs < __lhs; }
866 template<
typename _Rep1,
typename _Period1,
867 typename _Rep2,
typename _Period2>
871 {
return !(__lhs < __rhs); }
876 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 877 # define _GLIBCXX_CHRONO_INT64_T int64_t 878 #elif defined __INT64_TYPE__ 879 # define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__ 882 "Representation type for nanoseconds must have at least 64 bits");
883 # define _GLIBCXX_CHRONO_INT64_T long long 905 #if __cplusplus > 201703L 919 #undef _GLIBCXX_CHRONO_INT64_T 921 template<
typename _Clock,
typename _Dur>
924 static_assert(__is_duration<_Dur>::value,
925 "duration must be a specialization of std::chrono::duration");
928 typedef _Clock clock;
930 typedef typename duration::rep rep;
931 typedef typename duration::period period;
933 constexpr
time_point() : __d(duration::zero())
941 template<
typename _Dur2,
942 typename = _Require<is_convertible<_Dur2, _Dur>>>
944 : __d(__t.time_since_epoch())
949 time_since_epoch()
const 952 #if __cplusplus > 201703L 1016 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1017 _GLIBCXX_NODISCARD constexpr
1018 __enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
1022 return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
1025 #if __cplusplus > 201402L 1038 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1039 [[nodiscard]] constexpr
1044 chrono::floor<_ToDur>(__tp.time_since_epoch())};
1059 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1060 [[nodiscard]] constexpr
1065 chrono::ceil<_ToDur>(__tp.time_since_epoch())};
1081 template<
typename _ToDur,
typename _Clock,
typename _Dur>
1082 [[nodiscard]] constexpr
1084 && !treat_as_floating_point_v<typename _ToDur::rep>,
1085 time_point<_Clock, _ToDur>>
1089 chrono::round<_ToDur>(__tp.time_since_epoch())};
1097 template<
typename _Clock,
typename _Dur1,
1098 typename _Rep2,
typename _Period2>
1099 constexpr time_point<_Clock,
1102 const duration<_Rep2, _Period2>& __rhs)
1104 typedef duration<_Rep2, _Period2> __dur2;
1107 return __time_point(__lhs.time_since_epoch() + __rhs);
1111 template<
typename _Rep1,
typename _Period1,
1112 typename _Clock,
typename _Dur2>
1121 return __time_point(__rhs.time_since_epoch() + __lhs);
1125 template<
typename _Clock,
typename _Dur1,
1126 typename _Rep2,
typename _Period2>
1127 constexpr time_point<_Clock,
1135 return __time_point(__lhs.time_since_epoch() -__rhs);
1139 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1143 {
return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
1151 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1153 operator==(
const time_point<_Clock, _Dur1>& __lhs,
1154 const time_point<_Clock, _Dur2>& __rhs)
1155 {
return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
1157 #if __cpp_lib_three_way_comparison 1158 template<
typename _Clock,
typename _Dur1,
1159 three_way_comparable_with<_Dur1> _Dur2>
1161 operator<=>(
const time_point<_Clock, _Dur1>& __lhs,
1162 const time_point<_Clock, _Dur2>& __rhs)
1163 {
return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); }
1165 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1167 operator!=(
const time_point<_Clock, _Dur1>& __lhs,
1168 const time_point<_Clock, _Dur2>& __rhs)
1169 {
return !(__lhs == __rhs); }
1172 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1174 operator<(const time_point<_Clock, _Dur1>& __lhs,
1175 const time_point<_Clock, _Dur2>& __rhs)
1176 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
1178 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1180 operator<=(const time_point<_Clock, _Dur1>& __lhs,
1181 const time_point<_Clock, _Dur2>& __rhs)
1182 {
return !(__rhs < __lhs); }
1184 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1186 operator>(
const time_point<_Clock, _Dur1>& __lhs,
1187 const time_point<_Clock, _Dur2>& __rhs)
1188 {
return __rhs < __lhs; }
1190 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
1192 operator>=(
const time_point<_Clock, _Dur1>& __lhs,
1193 const time_point<_Clock, _Dur2>& __rhs)
1194 {
return !(__lhs < __rhs); }
1217 _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
1228 typedef duration::rep rep;
1229 typedef duration::period period;
1232 static_assert(system_clock::duration::min()
1233 < system_clock::duration::zero(),
1234 "a clock's minimum duration cannot be less than its epoch");
1236 static constexpr
bool is_steady =
false;
1245 return std::time_t(duration_cast<chrono::seconds>
1246 (__t.time_since_epoch()).count());
1250 from_time_t(std::time_t __t) noexcept
1268 typedef duration::rep rep;
1269 typedef duration::period period;
1272 static constexpr
bool is_steady =
true;
1289 _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
1291 #if __cplusplus >= 202002L 1294 template<
typename _Duration>
1299 using file_clock = ::std::filesystem::__file_clock;
1301 template<
typename _Duration>
1305 template<>
struct is_clock<steady_clock> :
true_type { };
1306 template<>
struct is_clock<file_clock> :
true_type { };
1308 template<>
inline constexpr
bool is_clock_v<system_clock> =
true;
1309 template<>
inline constexpr
bool is_clock_v<steady_clock> =
true;
1310 template<>
inline constexpr
bool is_clock_v<file_clock> =
true;
1315 #if __cplusplus >= 201402L 1316 #define __cpp_lib_chrono_udls 201304L 1318 inline namespace literals
1344 inline namespace chrono_literals
1349 #pragma GCC diagnostic push 1350 #pragma GCC diagnostic ignored "-Wliteral-suffix" 1352 template<
typename _Dur,
char... _Digits>
1353 constexpr _Dur __check_overflow()
1355 using _Val = __parse_int::_Parse_int<_Digits...>;
1356 constexpr
typename _Dur::rep __repval = _Val::value;
1357 static_assert(__repval >= 0 && __repval == _Val::value,
1358 "literal value cannot be represented by duration type");
1359 return _Dur(__repval);
1364 constexpr chrono::duration<long double, ratio<3600,1>>
1365 operator""h(
long double __hours)
1369 template <
char... _Digits>
1376 operator""min(
long double __mins)
1380 template <
char... _Digits>
1387 operator""s(
long double __secs)
1391 template <
char... _Digits>
1398 operator""ms(
long double __msecs)
1402 template <
char... _Digits>
1409 operator""us(
long double __usecs)
1413 template <
char... _Digits>
1420 operator""ns(
long double __nsecs)
1424 template <
char... _Digits>
1429 #pragma GCC diagnostic pop 1436 using namespace literals::chrono_literals;
1440 #if __cplusplus >= 201703L 1441 namespace filesystem
1446 using rep = duration::rep;
1447 using period = duration::period;
1448 using time_point = chrono::time_point<__file_clock>;
1449 static constexpr
bool is_steady =
false;
1453 {
return _S_from_sys(chrono::system_clock::now()); }
1455 #if __cplusplus > 201703L 1456 template<
typename _Dur>
1458 chrono::file_time<_Dur>
1459 from_sys(
const chrono::sys_time<_Dur>& __t) noexcept
1460 {
return _S_from_sys(__t); }
1463 template<
typename _Dur>
1465 chrono::sys_time<_Dur>
1466 to_sys(
const chrono::file_time<_Dur>& __t) noexcept
1467 {
return _S_to_sys(__t); }
1471 using __sys_clock = chrono::system_clock;
1480 template<
typename _Dur>
1482 chrono::time_point<__file_clock, _Dur>
1483 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
1485 using __file_time = chrono::time_point<__file_clock, _Dur>;
1486 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
1490 template<
typename _Dur>
1492 chrono::time_point<__sys_clock, _Dur>
1493 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t) noexcept
1495 using __sys_time = chrono::time_point<__sys_clock, _Dur>;
1496 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
1502 _GLIBCXX_END_NAMESPACE_VERSION
1507 #endif //_GLIBCXX_CHRONO_H
duration< int64_t > seconds
seconds
constexpr __enable_if_is_duration< _ToDur > floor(const duration< _Rep, _Period > &__d)
integral_constant< bool, __v > bool_constant
Alias template for compile-time boolean constant types.
constexpr time_point< _Clock, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator+(const time_point< _Clock, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
static constexpr _Tp max() noexcept
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
Define a member typedef type only if a boolean constant is true.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
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 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, __disable_if_is_duration< _Rep2 > >, _Period > operator%(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
constexpr __enable_if_t< __is_duration< _ToDur >::value, time_point< _Clock, _ToDur > > time_point_cast(const time_point< _Clock, _Dur > &__t)
void void_t
A metafunction that always yields void, used for detecting valid types.
duration< int64_t, micro > microseconds
microseconds
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
constexpr enable_if_t< __and_< __is_duration< _ToDur >, __not_< treat_as_floating_point< typename _ToDur::rep > > >::value, _ToDur > round(const duration< _Rep, _Period > &__d)
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
ISO C++ entities toplevel namespace is std.
Properties of fundamental types.
constexpr duration< __common_rep_t< _Rep2, _Rep1 >, _Period > operator*(const _Rep1 &__s, const duration< _Rep2, _Period > &__d)
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)
The difference between two durations.
chrono::duration represents a distance between two points in time
constexpr __enable_if_is_duration< _ToDur > ceil(const duration< _Rep, _Period > &__d)
duration< int64_t, nano > nanoseconds
nanoseconds
duration< int64_t, milli > milliseconds
milliseconds
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration< int64_t, ratio< 60 > > minutes
minutes
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)
duration< int64_t, ratio< 3600 > > hours
hours
constexpr bool operator!=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Provides compile-time rational arithmetic.
concept same_as
[concept.same], concept same_as
static constexpr _Tp lowest() noexcept
constexpr bool operator==(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr enable_if_t< numeric_limits< _Rep >::is_signed, duration< _Rep, _Period > > abs(duration< _Rep, _Period > __d)
constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator+(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)