30 #ifndef _GLIBCXX_CHRONO
31 #define _GLIBCXX_CHRONO 1
33 #pragma GCC system_header
35 #if __cplusplus < 201103L
44 #if __cplusplus > 201703L
49 namespace std _GLIBCXX_VISIBILITY(default)
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 #if __cplusplus >= 201703L
54 namespace filesystem {
struct __file_clock; };
70 template<
typename _Rep,
typename _Period = ratio<1>>
73 template<
typename _Clock,
typename _Dur =
typename _Clock::duration>
81 template<
typename _CT,
typename _Period1,
typename _Period2,
typename =
void>
82 struct __duration_common_type
85 template<
typename _CT,
typename _Period1,
typename _Period2>
86 struct __duration_common_type<_CT, _Period1, _Period2,
87 __void_t<typename _CT::type>>
90 using __gcd_num = __static_gcd<_Period1::num, _Period2::num>;
91 using __gcd_den = __static_gcd<_Period1::den, _Period2::den>;
92 using __cr =
typename _CT::type;
93 using __r =
ratio<__gcd_num::value,
94 (_Period1::den / __gcd_den::value) * _Period2::den>;
100 template<
typename _Period1,
typename _Period2>
101 struct __duration_common_type<__failure_type, _Period1, _Period2>
102 {
typedef __failure_type type; };
108 template<
typename _Rep1,
typename _Period1,
typename _Rep2,
typename _Period2>
111 : __duration_common_type<common_type<_Rep1, _Rep2>, _Period1, _Period2>
118 template<
typename _CT,
typename _Clock,
typename =
void>
119 struct __timepoint_common_type
122 template<
typename _CT,
typename _Clock>
123 struct __timepoint_common_type<_CT, _Clock, __void_t<typename _CT::type>>
125 using type = chrono::time_point<_Clock, typename _CT::type>;
132 template<
typename _Clock,
typename _Duration1,
typename _Duration2>
135 : __timepoint_common_type<common_type<_Duration1, _Duration2>, _Clock>
148 template<
typename _ToDur,
typename _CF,
typename _CR,
149 bool _NumIsOne =
false,
bool _DenIsOne =
false>
150 struct __duration_cast_impl
152 template<
typename _Rep,
typename _Period>
153 static constexpr _ToDur
154 __cast(
const duration<_Rep, _Period>& __d)
156 typedef typename _ToDur::rep __to_rep;
157 return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
158 * static_cast<_CR>(_CF::num)
159 /
static_cast<_CR
>(_CF::den)));
163 template<
typename _ToDur,
typename _CF,
typename _CR>
164 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
166 template<
typename _Rep,
typename _Period>
167 static constexpr _ToDur
168 __cast(
const duration<_Rep, _Period>& __d)
170 typedef typename _ToDur::rep __to_rep;
171 return _ToDur(static_cast<__to_rep>(__d.count()));
175 template<
typename _ToDur,
typename _CF,
typename _CR>
176 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
178 template<
typename _Rep,
typename _Period>
179 static constexpr _ToDur
180 __cast(
const duration<_Rep, _Period>& __d)
182 typedef typename _ToDur::rep __to_rep;
183 return _ToDur(static_cast<__to_rep>(
184 static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
188 template<
typename _ToDur,
typename _CF,
typename _CR>
189 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
191 template<
typename _Rep,
typename _Period>
192 static constexpr _ToDur
193 __cast(
const duration<_Rep, _Period>& __d)
195 typedef typename _ToDur::rep __to_rep;
196 return _ToDur(static_cast<__to_rep>(
197 static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
201 template<
typename _Tp>
206 template<
typename _Rep,
typename _Period>
207 struct __is_duration<duration<_Rep, _Period>>
211 template<
typename _Tp>
212 using __enable_if_is_duration
213 =
typename enable_if<__is_duration<_Tp>::value, _Tp>::type;
215 template<
typename _Tp>
216 using __disable_if_is_duration
217 =
typename enable_if<!__is_duration<_Tp>::value, _Tp>::type;
222 template<
typename _ToDur,
typename _Rep,
typename _Period>
223 constexpr __enable_if_is_duration<_ToDur>
226 typedef typename _ToDur::period __to_period;
227 typedef typename _ToDur::rep __to_rep;
231 typedef __duration_cast_impl<_ToDur, __cf, __cr,
232 __cf::num == 1, __cf::den == 1> __dc;
233 return __dc::__cast(__d);
237 template<
typename _Rep>
242 #if __cplusplus > 201402L
243 template <
typename _Rep>
244 inline constexpr
bool treat_as_floating_point_v =
248 #if __cplusplus > 201703L
249 template<
typename _Tp>
252 template<
typename _Tp>
253 inline constexpr
bool is_clock_v = is_clock<_Tp>::value;
255 #if __cpp_lib_concepts
256 template<
typename _Tp>
260 template<
typename _Tp>
263 typename _Tp::period;
264 typename _Tp::duration;
265 typename _Tp::time_point::clock;
266 typename _Tp::time_point::duration;
267 { &_Tp::is_steady } -> same_as<const bool*>;
268 { _Tp::now() } -> same_as<typename _Tp::time_point>;
269 requires same_as<
typename _Tp::duration,
270 duration<typename _Tp::rep, typename _Tp::period>>;
271 requires same_as<
typename _Tp::time_point::duration,
272 typename _Tp::duration>;
277 template<
typename _Tp,
typename =
void>
281 template<
typename _Tp>
282 struct __is_clock_impl<_Tp,
283 void_t<typename _Tp::rep, typename _Tp::period,
284 typename _Tp::duration,
285 typename _Tp::time_point::duration,
286 decltype(_Tp::is_steady),
287 decltype(_Tp::now())>>
288 : __and_<is_same<typename _Tp::duration,
289 duration<typename _Tp::rep, typename _Tp::period>>,
290 is_same<typename _Tp::time_point::duration,
291 typename _Tp::duration>,
292 is_same<decltype(&_Tp::is_steady), const bool*>,
293 is_same<decltype(_Tp::now()), typename _Tp::time_point>>::type
296 template<
typename _Tp>
297 struct is_clock : __is_clock_impl<_Tp>::type
302 #if __cplusplus >= 201703L
303 # define __cpp_lib_chrono 201611
305 template<
typename _ToDur,
typename _Rep,
typename _Period>
306 constexpr __enable_if_is_duration<_ToDur>
307 floor(
const duration<_Rep, _Period>& __d)
311 return __to - _ToDur{1};
315 template<
typename _ToDur,
typename _Rep,
typename _Period>
316 constexpr __enable_if_is_duration<_ToDur>
317 ceil(
const duration<_Rep, _Period>& __d)
321 return __to + _ToDur{1};
325 template <
typename _ToDur,
typename _Rep,
typename _Period>
327 __and_<__is_duration<_ToDur>,
328 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
330 round(
const duration<_Rep, _Period>& __d)
332 _ToDur __t0 = chrono::floor<_ToDur>(__d);
333 _ToDur __t1 = __t0 + _ToDur{1};
334 auto __diff0 = __d - __t0;
335 auto __diff1 = __t1 - __d;
336 if (__diff0 == __diff1)
338 if (__t0.count() & 1)
342 else if (__diff0 < __diff1)
347 template<
typename _Rep,
typename _Period>
349 enable_if_t<numeric_limits<_Rep>::is_signed, duration<_Rep, _Period>>
350 abs(duration<_Rep, _Period> __d)
352 if (__d >= __d.zero())
359 template<
typename _Rep>
362 static constexpr _Rep
366 static constexpr _Rep
370 static constexpr _Rep
377 template<
typename _Tp>
382 template<
intmax_t _Num,
intmax_t _Den>
383 struct __is_ratio<
ratio<_Num, _Den>>
390 template<
typename _Rep,
typename _Period>
394 template<
typename _Rep2>
395 using __is_float = treat_as_floating_point<_Rep2>;
398 template<
typename _Period2>
400 = __bool_constant<ratio_divide<_Period2, _Period>::den == 1>;
405 typedef _Period period;
407 static_assert(!__is_duration<_Rep>::value,
"rep cannot be a duration");
408 static_assert(__is_ratio<_Period>::value,
409 "period must be a specialization of ratio");
410 static_assert(_Period::num > 0,
"period must be positive");
413 constexpr duration() =
default;
415 duration(
const duration&) =
default;
419 template<
typename _Rep2,
typename = _Require<
420 is_convertible<const _Rep2&, rep>,
421 __or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>>
422 constexpr
explicit duration(
const _Rep2& __rep)
423 : __r(static_cast<rep>(__rep)) { }
425 template<
typename _Rep2,
typename _Period2,
typename = _Require<
426 __or_<__is_float<rep>,
427 __and_<__is_harmonic<_Period2>,
428 __not_<__is_float<_Rep2>>>>>>
429 constexpr duration(
const duration<_Rep2, _Period2>& __d)
432 ~duration() =
default;
433 duration& operator=(
const duration&) =
default;
447 {
return duration(-__r); }
449 _GLIBCXX17_CONSTEXPR duration&
456 _GLIBCXX17_CONSTEXPR duration
458 {
return duration(__r++); }
460 _GLIBCXX17_CONSTEXPR duration&
467 _GLIBCXX17_CONSTEXPR duration
469 {
return duration(__r--); }
471 _GLIBCXX17_CONSTEXPR duration&
472 operator+=(
const duration& __d)
478 _GLIBCXX17_CONSTEXPR duration&
479 operator-=(
const duration& __d)
485 _GLIBCXX17_CONSTEXPR duration&
486 operator*=(
const rep& __rhs)
492 _GLIBCXX17_CONSTEXPR duration&
493 operator/=(
const rep& __rhs)
500 template<
typename _Rep2 = rep>
502 typename enable_if<!treat_as_floating_point<_Rep2>::value,
504 operator%=(
const rep& __rhs)
510 template<
typename _Rep2 = rep>
512 typename enable_if<!treat_as_floating_point<_Rep2>::value,
514 operator%=(
const duration& __d)
521 static constexpr duration
523 {
return duration(duration_values<rep>::zero()); }
525 static constexpr duration
529 static constexpr duration
540 template<
typename _Rep1,
typename _Period1,
541 typename _Rep2,
typename _Period2>
542 constexpr
typename common_type<duration<_Rep1, _Period1>,
543 duration<_Rep2, _Period2>>::type
550 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
554 template<
typename _Rep1,
typename _Period1,
555 typename _Rep2,
typename _Period2>
564 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
575 template<
typename _Rep1,
typename _Rep2,
577 using __common_rep_t =
typename
585 template<
typename _Rep1,
typename _Period,
typename _Rep2>
591 return __cd(__cd(__d).count() * __s);
595 template<
typename _Rep1,
typename _Rep2,
typename _Period>
598 {
return __d * __s; }
600 template<
typename _Rep1,
typename _Period,
typename _Rep2>
607 return __cd(__cd(__d).count() / __s);
610 template<
typename _Rep1,
typename _Period1,
611 typename _Rep2,
typename _Period2>
613 operator/(
const duration<_Rep1, _Period1>& __lhs,
614 const duration<_Rep2, _Period2>& __rhs)
616 typedef duration<_Rep1, _Period1> __dur1;
617 typedef duration<_Rep2, _Period2> __dur2;
619 return __cd(__lhs).count() / __cd(__rhs).count();
623 template<
typename _Rep1,
typename _Period,
typename _Rep2>
625 duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period>
626 operator%(
const duration<_Rep1, _Period>& __d,
const _Rep2& __s)
628 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
630 return __cd(__cd(__d).count() % __s);
633 template<
typename _Rep1,
typename _Period1,
634 typename _Rep2,
typename _Period2>
635 constexpr
typename common_type<duration<_Rep1, _Period1>,
636 duration<_Rep2, _Period2>>::type
637 operator%(
const duration<_Rep1, _Period1>& __lhs,
638 const duration<_Rep2, _Period2>& __rhs)
640 typedef duration<_Rep1, _Period1> __dur1;
641 typedef duration<_Rep2, _Period2> __dur2;
642 typedef typename common_type<__dur1,__dur2>::type __cd;
643 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
648 template<
typename _Rep1,
typename _Period1,
649 typename _Rep2,
typename _Period2>
651 operator==(
const duration<_Rep1, _Period1>& __lhs,
652 const duration<_Rep2, _Period2>& __rhs)
654 typedef duration<_Rep1, _Period1> __dur1;
655 typedef duration<_Rep2, _Period2> __dur2;
656 typedef typename common_type<__dur1,__dur2>::type __ct;
657 return __ct(__lhs).count() == __ct(__rhs).count();
660 template<
typename _Rep1,
typename _Period1,
661 typename _Rep2,
typename _Period2>
663 operator<(const duration<_Rep1, _Period1>& __lhs,
664 const duration<_Rep2, _Period2>& __rhs)
666 typedef duration<_Rep1, _Period1> __dur1;
667 typedef duration<_Rep2, _Period2> __dur2;
668 typedef typename common_type<__dur1,__dur2>::type __ct;
669 return __ct(__lhs).count() < __ct(__rhs).count();
672 #if __cpp_lib_three_way_comparison
673 template<
typename _Rep1,
typename _Period1,
674 typename _Rep2,
typename _Period2>
675 requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
677 operator<=>(
const duration<_Rep1, _Period1>& __lhs,
678 const duration<_Rep2, _Period2>& __rhs)
680 using __ct = common_type_t<duration<_Rep1, _Period1>,
681 duration<_Rep2, _Period2>>;
682 return __ct(__lhs).count() <=> __ct(__rhs).count();
685 template<
typename _Rep1,
typename _Period1,
686 typename _Rep2,
typename _Period2>
688 operator!=(
const duration<_Rep1, _Period1>& __lhs,
689 const duration<_Rep2, _Period2>& __rhs)
690 {
return !(__lhs == __rhs); }
693 template<
typename _Rep1,
typename _Period1,
694 typename _Rep2,
typename _Period2>
696 operator<=(const duration<_Rep1, _Period1>& __lhs,
697 const duration<_Rep2, _Period2>& __rhs)
698 {
return !(__rhs < __lhs); }
700 template<
typename _Rep1,
typename _Period1,
701 typename _Rep2,
typename _Period2>
703 operator>(
const duration<_Rep1, _Period1>& __lhs,
704 const duration<_Rep2, _Period2>& __rhs)
705 {
return __rhs < __lhs; }
707 template<
typename _Rep1,
typename _Period1,
708 typename _Rep2,
typename _Period2>
710 operator>=(
const duration<_Rep1, _Period1>& __lhs,
711 const duration<_Rep2, _Period2>& __rhs)
712 {
return !(__lhs < __rhs); }
716 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
717 # define _GLIBCXX_CHRONO_INT64_T int64_t
718 #elif defined __INT64_TYPE__
719 # define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__
722 "Representation type for nanoseconds must have at least 64 bits");
723 # define _GLIBCXX_CHRONO_INT64_T long long
744 #if __cplusplus > 201703L
758 #undef _GLIBCXX_CHRONO_INT64_T
761 template<
typename _Clock,
typename _Dur>
764 static_assert(__is_duration<_Dur>::value,
765 "duration must be a specialization of std::chrono::duration");
767 typedef _Clock clock;
769 typedef typename duration::rep rep;
770 typedef typename duration::period period;
772 constexpr
time_point() : __d(duration::zero())
775 constexpr
explicit time_point(
const duration& __dur)
780 template<
typename _Dur2,
781 typename = _Require<is_convertible<_Dur2, _Dur>>>
783 : __d(__t.time_since_epoch())
788 time_since_epoch()
const
792 _GLIBCXX17_CONSTEXPR time_point&
799 _GLIBCXX17_CONSTEXPR time_point&
807 static constexpr time_point
809 {
return time_point(duration::min()); }
811 static constexpr time_point
813 {
return time_point(duration::max()); }
820 template<
typename _ToDur,
typename _Clock,
typename _Dur>
822 time_point<_Clock, _ToDur>>::type
826 return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
829 #if __cplusplus > 201402L
830 template<
typename _ToDur,
typename _Clock,
typename _Dur>
833 floor(
const time_point<_Clock, _Dur>& __tp)
835 return time_point<_Clock, _ToDur>{
836 chrono::floor<_ToDur>(__tp.time_since_epoch())};
839 template<
typename _ToDur,
typename _Clock,
typename _Dur>
841 enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>
842 ceil(
const time_point<_Clock, _Dur>& __tp)
844 return time_point<_Clock, _ToDur>{
845 chrono::ceil<_ToDur>(__tp.time_since_epoch())};
848 template<
typename _ToDur,
typename _Clock,
typename _Dur>
850 __and_<__is_duration<_ToDur>,
851 __not_<treat_as_floating_point<typename _ToDur::rep>>>::value,
852 time_point<_Clock, _ToDur>>
853 round(
const time_point<_Clock, _Dur>& __tp)
855 return time_point<_Clock, _ToDur>{
856 chrono::round<_ToDur>(__tp.time_since_epoch())};
863 template<
typename _Clock,
typename _Dur1,
864 typename _Rep2,
typename _Period2>
865 constexpr time_point<_Clock,
866 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
868 const duration<_Rep2, _Period2>& __rhs)
870 typedef duration<_Rep2, _Period2> __dur2;
873 return __time_point(__lhs.time_since_epoch() + __rhs);
877 template<
typename _Rep1,
typename _Period1,
878 typename _Clock,
typename _Dur2>
884 typedef duration<_Rep1, _Period1> __dur1;
887 return __time_point(__rhs.time_since_epoch() + __lhs);
891 template<
typename _Clock,
typename _Dur1,
892 typename _Rep2,
typename _Period2>
896 const duration<_Rep2, _Period2>& __rhs)
898 typedef duration<_Rep2, _Period2> __dur2;
901 return __time_point(__lhs.time_since_epoch() -__rhs);
909 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
913 {
return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
915 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
919 {
return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
921 #if __cpp_lib_three_way_comparison
922 template<
typename _Clock,
typename _Dur1,
923 three_way_comparable_with<_Dur1> _Dur2>
925 operator<=>(
const time_point<_Clock, _Dur1>& __lhs,
926 const time_point<_Clock, _Dur2>& __rhs)
927 {
return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); }
929 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
931 operator!=(
const time_point<_Clock, _Dur1>& __lhs,
932 const time_point<_Clock, _Dur2>& __rhs)
933 {
return !(__lhs == __rhs); }
936 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
938 operator<(const time_point<_Clock, _Dur1>& __lhs,
939 const time_point<_Clock, _Dur2>& __rhs)
940 {
return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
942 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
944 operator<=(const time_point<_Clock, _Dur1>& __lhs,
945 const time_point<_Clock, _Dur2>& __rhs)
946 {
return !(__rhs < __lhs); }
948 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
950 operator>(
const time_point<_Clock, _Dur1>& __lhs,
951 const time_point<_Clock, _Dur2>& __rhs)
952 {
return __rhs < __lhs; }
954 template<
typename _Clock,
typename _Dur1,
typename _Dur2>
956 operator>=(
const time_point<_Clock, _Dur1>& __lhs,
957 const time_point<_Clock, _Dur2>& __rhs)
958 {
return !(__lhs < __rhs); }
980 inline namespace _V2 {
991 typedef duration::rep rep;
992 typedef duration::period period;
995 static_assert(system_clock::duration::min()
996 < system_clock::duration::zero(),
997 "a clock's minimum duration cannot be less than its epoch");
999 static constexpr
bool is_steady =
false;
1008 return std::time_t(duration_cast<chrono::seconds>
1009 (__t.time_since_epoch()).count());
1013 from_time_t(std::time_t __t) noexcept
1031 typedef duration::rep rep;
1032 typedef duration::period period;
1035 static constexpr
bool is_steady =
true;
1054 #if __cplusplus > 201703L
1055 template<
typename _Duration>
1057 using sys_seconds = sys_time<seconds>;
1058 using sys_days = sys_time<days>;
1060 using file_clock = ::std::filesystem::__file_clock;
1062 template<
typename _Duration>
1065 template<>
struct is_clock<system_clock> :
true_type { };
1066 template<>
struct is_clock<steady_clock> :
true_type { };
1067 template<>
struct is_clock<file_clock> :
true_type { };
1069 template<>
inline constexpr
bool is_clock_v<system_clock> =
true;
1070 template<>
inline constexpr
bool is_clock_v<steady_clock> =
true;
1071 template<>
inline constexpr
bool is_clock_v<file_clock> =
true;
1074 template<
typename _Duration>
1075 using local_time = time_point<local_t, _Duration>;
1076 using local_seconds = local_time<seconds>;
1077 using local_days = local_time<days>;
1083 #if __cplusplus > 201103L
1085 #define __cpp_lib_chrono_udls 201304
1087 inline namespace literals
1112 inline namespace chrono_literals
1114 #pragma GCC diagnostic push
1115 #pragma GCC diagnostic ignored "-Wliteral-suffix"
1117 template<
typename _Dur,
char... _Digits>
1118 constexpr _Dur __check_overflow()
1120 using _Val = __parse_int::_Parse_int<_Digits...>;
1121 constexpr
typename _Dur::rep __repval = _Val::value;
1122 static_assert(__repval >= 0 && __repval == _Val::value,
1123 "literal value cannot be represented by duration type");
1124 return _Dur(__repval);
1130 operator""h(
long double __hours)
1134 template <
char... _Digits>
1141 operator""min(
long double __mins)
1145 template <
char... _Digits>
1152 operator""s(
long double __secs)
1156 template <
char... _Digits>
1163 operator""ms(
long double __msecs)
1167 template <
char... _Digits>
1174 operator""us(
long double __usecs)
1178 template <
char... _Digits>
1185 operator""ns(
long double __nsecs)
1189 template <
char... _Digits>
1194 #pragma GCC diagnostic pop
1200 using namespace literals::chrono_literals;
1203 #if __cplusplus >= 201703L
1204 namespace filesystem
1209 using rep = duration::rep;
1210 using period = duration::period;
1211 using time_point = chrono::time_point<__file_clock>;
1212 static constexpr
bool is_steady =
false;
1216 {
return _S_from_sys(chrono::system_clock::now()); }
1218 #if __cplusplus > 201703L
1219 template<
typename _Dur>
1221 chrono::file_time<_Dur>
1222 from_sys(
const chrono::sys_time<_Dur>& __t) noexcept
1223 {
return _S_from_sys(__t); }
1226 template<
typename _Dur>
1228 chrono::sys_time<_Dur>
1229 to_sys(
const chrono::file_time<_Dur>& __t) noexcept
1230 {
return _S_to_sys(__t); }
1234 using __sys_clock = chrono::system_clock;
1243 template<
typename _Dur>
1245 chrono::time_point<__file_clock, _Dur>
1246 _S_from_sys(
const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
1248 using __file_time = chrono::time_point<__file_clock, _Dur>;
1249 return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
1253 template<
typename _Dur>
1255 chrono::time_point<__sys_clock, _Dur>
1256 _S_to_sys(
const chrono::time_point<__file_clock, _Dur>& __t) noexcept
1258 using __sys_time = chrono::time_point<__sys_clock, _Dur>;
1259 return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
1266 _GLIBCXX_END_NAMESPACE_VERSION
1271 #endif //_GLIBCXX_CHRONO
constexpr duration< __common_rep_t< _Rep2, _Rep1 >, _Period > operator*(const _Rep1 &__s, const duration< _Rep2, _Period > &__d)
Multiply a duration by a scalar value.
constexpr common_type< _Dur1, _Dur2 >::type operator-(const time_point< _Clock, _Dur1 > &__lhs, const time_point< _Clock, _Dur2 > &__rhs)
The difference between two time points (as a duration)
static constexpr _Tp lowest() noexcept
duration< int64_t, ratio< 60 >> minutes
minutes
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
constexpr duration< __common_rep_t< _Rep1, _Rep2 >, _Period > operator*(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
Multiply a duration by a scalar value.
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.
static constexpr _Tp max() noexcept
Define a member typedef type only if a boolean constant is true.
duration< int64_t, micro > microseconds
microseconds
constexpr time_point< _Clock, typename common_type< _Dur1, duration< _Rep2, _Period2 > >::type > operator-(const time_point< _Clock, _Dur1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Adjust a time point backwards by the given duration.
duration< int64_t, nano > nanoseconds
nanoseconds
constexpr enable_if< __is_duration< _ToDur >::value, time_point< _Clock, _ToDur > >::type time_point_cast(const time_point< _Clock, _Dur > &__t)
time_point_cast
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
duration< int64_t, milli > milliseconds
milliseconds
void void_t
A metafunction that always yields void, used for detecting valid types.
Properties of fundamental types.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
typename __ratio_divide< _R1, _R2 >::type ratio_divide
ratio_divide
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration_cast
duration< int64_t > seconds
seconds
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.
Provides compile-time rational arithmetic.
duration< int64_t, ratio< 3600 >> hours
hours
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 complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
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.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.