3// Copyright (C) 2008-2016 Free Software Foundation, Inc.
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
25/** @file include/chrono
26 * This is a Standard C++ Library header.
29#ifndef _GLIBCXX_CHRONO
30#define _GLIBCXX_CHRONO 1
32#pragma GCC system_header
34#if __cplusplus < 201103L
35# include <bits/c++0x_warning.h>
42#include <bits/parse_numbers.h> // for literals support.
44#ifdef _GLIBCXX_USE_C99_STDINT_TR1
46namespace std _GLIBCXX_VISIBILITY(default)
49 * @defgroup chrono Time
52 * Classes and functions for time.
56 /** @namespace std::chrono
57 * @brief ISO C++ 2011 entities sub-namespace for time and date.
61 _GLIBCXX_BEGIN_NAMESPACE_VERSION
63 template<typename _Rep, typename _Period = ratio<1>>
66 template<typename _Clock, typename _Dur = typename _Clock::duration>
69 _GLIBCXX_END_NAMESPACE_VERSION
72_GLIBCXX_BEGIN_NAMESPACE_VERSION
74 // 20.11.4.3 specialization of common_type (for duration, sfinae-friendly)
76 template<typename _CT, typename _Period1, typename _Period2>
77 struct __duration_common_type_wrapper
80 typedef __static_gcd<_Period1::num, _Period2::num> __gcd_num;
81 typedef __static_gcd<_Period1::den, _Period2::den> __gcd_den;
82 typedef typename _CT::type __cr;
83 typedef ratio<__gcd_num::value,
84 (_Period1::den / __gcd_den::value) * _Period2::den> __r;
86 typedef __success_type<chrono::duration<__cr, __r>> type;
89 template<typename _Period1, typename _Period2>
90 struct __duration_common_type_wrapper<__failure_type, _Period1, _Period2>
91 { typedef __failure_type type; };
93 template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2>
94 struct common_type<chrono::duration<_Rep1, _Period1>,
95 chrono::duration<_Rep2, _Period2>>
96 : public __duration_common_type_wrapper<typename __member_type_wrapper<
97 common_type<_Rep1, _Rep2>>::type, _Period1, _Period2>::type
100 // 20.11.4.3 specialization of common_type (for time_point, sfinae-friendly)
102 template<typename _CT, typename _Clock>
103 struct __timepoint_common_type_wrapper
105 typedef __success_type<chrono::time_point<_Clock, typename _CT::type>>
109 template<typename _Clock>
110 struct __timepoint_common_type_wrapper<__failure_type, _Clock>
111 { typedef __failure_type type; };
113 template<typename _Clock, typename _Duration1, typename _Duration2>
114 struct common_type<chrono::time_point<_Clock, _Duration1>,
115 chrono::time_point<_Clock, _Duration2>>
116 : public __timepoint_common_type_wrapper<typename __member_type_wrapper<
117 common_type<_Duration1, _Duration2>>::type, _Clock>::type
120_GLIBCXX_END_NAMESPACE_VERSION
124 _GLIBCXX_BEGIN_NAMESPACE_VERSION
126 // Primary template for duration_cast impl.
127 template<typename _ToDur, typename _CF, typename _CR,
128 bool _NumIsOne = false, bool _DenIsOne = false>
129 struct __duration_cast_impl
131 template<typename _Rep, typename _Period>
132 static constexpr _ToDur
133 __cast(const duration<_Rep, _Period>& __d)
135 typedef typename _ToDur::rep __to_rep;
136 return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
137 * static_cast<_CR>(_CF::num)
138 / static_cast<_CR>(_CF::den)));
142 template<typename _ToDur, typename _CF, typename _CR>
143 struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
145 template<typename _Rep, typename _Period>
146 static constexpr _ToDur
147 __cast(const duration<_Rep, _Period>& __d)
149 typedef typename _ToDur::rep __to_rep;
150 return _ToDur(static_cast<__to_rep>(__d.count()));
154 template<typename _ToDur, typename _CF, typename _CR>
155 struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
157 template<typename _Rep, typename _Period>
158 static constexpr _ToDur
159 __cast(const duration<_Rep, _Period>& __d)
161 typedef typename _ToDur::rep __to_rep;
162 return _ToDur(static_cast<__to_rep>(
163 static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
167 template<typename _ToDur, typename _CF, typename _CR>
168 struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
170 template<typename _Rep, typename _Period>
171 static constexpr _ToDur
172 __cast(const duration<_Rep, _Period>& __d)
174 typedef typename _ToDur::rep __to_rep;
175 return _ToDur(static_cast<__to_rep>(
176 static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
180 template<typename _Tp>
185 template<typename _Rep, typename _Period>
186 struct __is_duration<duration<_Rep, _Period>>
191 template<typename _ToDur, typename _Rep, typename _Period>
192 constexpr typename enable_if<__is_duration<_ToDur>::value,
194 duration_cast(const duration<_Rep, _Period>& __d)
196 typedef typename _ToDur::period __to_period;
197 typedef typename _ToDur::rep __to_rep;
198 typedef ratio_divide<_Period, __to_period> __cf;
199 typedef typename common_type<__to_rep, _Rep, intmax_t>::type
201 typedef __duration_cast_impl<_ToDur, __cf, __cr,
202 __cf::num == 1, __cf::den == 1> __dc;
203 return __dc::__cast(__d);
206 /// treat_as_floating_point
207 template<typename _Rep>
208 struct treat_as_floating_point
209 : is_floating_point<_Rep>
213 template<typename _Rep>
214 struct duration_values
216 static constexpr _Rep
220 static constexpr _Rep
222 { return numeric_limits<_Rep>::max(); }
224 static constexpr _Rep
226 { return numeric_limits<_Rep>::lowest(); }
229 template<typename _Tp>
234 template<intmax_t _Num, intmax_t _Den>
235 struct __is_ratio<ratio<_Num, _Den>>
240 template<typename _Rep, typename _Period>
244 typedef _Period period;
246 static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration");
247 static_assert(__is_ratio<_Period>::value,
248 "period must be a specialization of ratio");
249 static_assert(_Period::num > 0, "period must be positive");
251 // 20.11.5.1 construction / copy / destroy
252 constexpr duration() = default;
254 // NB: Make constexpr implicit. This cannot be explicitly
255 // constexpr, as any UDT that is not a literal type with a
256 // constexpr copy constructor will be ill-formed.
257 duration(const duration&) = default;
259 // _GLIBCXX_RESOLVE_LIB_DEFECTS
260 // 3050. Conversion specification problem in chrono::duration
261 template<typename _Rep2, typename = typename
262 enable_if<is_convertible<const _Rep2&, rep>::value
263 && (treat_as_floating_point<rep>::value
264 || !treat_as_floating_point<_Rep2>::value)>::type>
265 constexpr explicit duration(const _Rep2& __rep)
266 : __r(static_cast<rep>(__rep)) { }
268 template<typename _Rep2, typename _Period2, typename = typename
269 enable_if<treat_as_floating_point<rep>::value
270 || (ratio_divide<_Period2, period>::den == 1
271 && !treat_as_floating_point<_Rep2>::value)>::type>
272 constexpr duration(const duration<_Rep2, _Period2>& __d)
273 : __r(duration_cast<duration>(__d).count()) { }
275 ~duration() = default;
276 duration& operator=(const duration&) = default;
278 // 20.11.5.2 observer
283 // 20.11.5.3 arithmetic
290 { return duration(-__r); }
301 { return duration(__r++); }
312 { return duration(__r--); }
315 operator+=(const duration& __d)
322 operator-=(const duration& __d)
329 operator*=(const rep& __rhs)
336 operator/=(const rep& __rhs)
343 template<typename _Rep2 = rep>
344 typename enable_if<!treat_as_floating_point<_Rep2>::value,
346 operator%=(const rep& __rhs)
352 template<typename _Rep2 = rep>
353 typename enable_if<!treat_as_floating_point<_Rep2>::value,
355 operator%=(const duration& __d)
361 // 20.11.5.4 special values
362 static constexpr duration
364 { return duration(duration_values<rep>::zero()); }
366 static constexpr duration
368 { return duration(duration_values<rep>::min()); }
370 static constexpr duration
372 { return duration(duration_values<rep>::max()); }
378 template<typename _Rep1, typename _Period1,
379 typename _Rep2, typename _Period2>
380 constexpr typename common_type<duration<_Rep1, _Period1>,
381 duration<_Rep2, _Period2>>::type
382 operator+(const duration<_Rep1, _Period1>& __lhs,
383 const duration<_Rep2, _Period2>& __rhs)
385 typedef duration<_Rep1, _Period1> __dur1;
386 typedef duration<_Rep2, _Period2> __dur2;
387 typedef typename common_type<__dur1,__dur2>::type __cd;
388 return __cd(__cd(__lhs).count() + __cd(__rhs).count());
391 template<typename _Rep1, typename _Period1,
392 typename _Rep2, typename _Period2>
393 constexpr typename common_type<duration<_Rep1, _Period1>,
394 duration<_Rep2, _Period2>>::type
395 operator-(const duration<_Rep1, _Period1>& __lhs,
396 const duration<_Rep2, _Period2>& __rhs)
398 typedef duration<_Rep1, _Period1> __dur1;
399 typedef duration<_Rep2, _Period2> __dur2;
400 typedef typename common_type<__dur1,__dur2>::type __cd;
401 return __cd(__cd(__lhs).count() - __cd(__rhs).count());
404 // SFINAE helper to obtain common_type<_Rep1, _Rep2> only if _Rep2
405 // is implicitly convertible to it.
406 // _GLIBCXX_RESOLVE_LIB_DEFECTS
407 // 3050. Conversion specification problem in chrono::duration constructor
408 template<typename _Rep1, typename _Rep2, bool =
409 is_convertible<const _Rep2&,
410 typename common_type<_Rep1, _Rep2>::type>::value>
411 struct __common_rep_type { };
413 template<typename _Rep1, typename _Rep2>
414 struct __common_rep_type<_Rep1, _Rep2, true>
415 { typedef typename common_type<_Rep1, _Rep2>::type type; };
417 template<typename _Rep1, typename _Period, typename _Rep2>
419 duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period>
420 operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
422 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
424 return __cd(__cd(__d).count() * __s);
427 template<typename _Rep1, typename _Rep2, typename _Period>
429 duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period>
430 operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
431 { return __d * __s; }
433 template<typename _Rep1, typename _Period, typename _Rep2>
434 constexpr duration<typename __common_rep_type<_Rep1, typename
435 enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
436 operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
438 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
440 return __cd(__cd(__d).count() / __s);
443 template<typename _Rep1, typename _Period1,
444 typename _Rep2, typename _Period2>
445 constexpr typename common_type<_Rep1, _Rep2>::type
446 operator/(const duration<_Rep1, _Period1>& __lhs,
447 const duration<_Rep2, _Period2>& __rhs)
449 typedef duration<_Rep1, _Period1> __dur1;
450 typedef duration<_Rep2, _Period2> __dur2;
451 typedef typename common_type<__dur1,__dur2>::type __cd;
452 return __cd(__lhs).count() / __cd(__rhs).count();
456 template<typename _Rep1, typename _Period, typename _Rep2>
457 constexpr duration<typename __common_rep_type<_Rep1, typename
458 enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
459 operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
461 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period>
463 return __cd(__cd(__d).count() % __s);
466 template<typename _Rep1, typename _Period1,
467 typename _Rep2, typename _Period2>
468 constexpr typename common_type<duration<_Rep1, _Period1>,
469 duration<_Rep2, _Period2>>::type
470 operator%(const duration<_Rep1, _Period1>& __lhs,
471 const duration<_Rep2, _Period2>& __rhs)
473 typedef duration<_Rep1, _Period1> __dur1;
474 typedef duration<_Rep2, _Period2> __dur2;
475 typedef typename common_type<__dur1,__dur2>::type __cd;
476 return __cd(__cd(__lhs).count() % __cd(__rhs).count());
480 template<typename _Rep1, typename _Period1,
481 typename _Rep2, typename _Period2>
483 operator==(const duration<_Rep1, _Period1>& __lhs,
484 const duration<_Rep2, _Period2>& __rhs)
486 typedef duration<_Rep1, _Period1> __dur1;
487 typedef duration<_Rep2, _Period2> __dur2;
488 typedef typename common_type<__dur1,__dur2>::type __ct;
489 return __ct(__lhs).count() == __ct(__rhs).count();
492 template<typename _Rep1, typename _Period1,
493 typename _Rep2, typename _Period2>
495 operator<(const duration<_Rep1, _Period1>& __lhs,
496 const duration<_Rep2, _Period2>& __rhs)
498 typedef duration<_Rep1, _Period1> __dur1;
499 typedef duration<_Rep2, _Period2> __dur2;
500 typedef typename common_type<__dur1,__dur2>::type __ct;
501 return __ct(__lhs).count() < __ct(__rhs).count();
504 template<typename _Rep1, typename _Period1,
505 typename _Rep2, typename _Period2>
507 operator!=(const duration<_Rep1, _Period1>& __lhs,
508 const duration<_Rep2, _Period2>& __rhs)
509 { return !(__lhs == __rhs); }
511 template<typename _Rep1, typename _Period1,
512 typename _Rep2, typename _Period2>
514 operator<=(const duration<_Rep1, _Period1>& __lhs,
515 const duration<_Rep2, _Period2>& __rhs)
516 { return !(__rhs < __lhs); }
518 template<typename _Rep1, typename _Period1,
519 typename _Rep2, typename _Period2>
521 operator>(const duration<_Rep1, _Period1>& __lhs,
522 const duration<_Rep2, _Period2>& __rhs)
523 { return __rhs < __lhs; }
525 template<typename _Rep1, typename _Period1,
526 typename _Rep2, typename _Period2>
528 operator>=(const duration<_Rep1, _Period1>& __lhs,
529 const duration<_Rep2, _Period2>& __rhs)
530 { return !(__lhs < __rhs); }
533 typedef duration<int64_t, nano> nanoseconds;
536 typedef duration<int64_t, micro> microseconds;
539 typedef duration<int64_t, milli> milliseconds;
542 typedef duration<int64_t> seconds;
545 typedef duration<int64_t, ratio< 60>> minutes;
548 typedef duration<int64_t, ratio<3600>> hours;
551 template<typename _Clock, typename _Dur>
554 typedef _Clock clock;
555 typedef _Dur duration;
556 typedef typename duration::rep rep;
557 typedef typename duration::period period;
559 constexpr time_point() : __d(duration::zero())
562 constexpr explicit time_point(const duration& __dur)
567 template<typename _Dur2,
568 typename = _Require<is_convertible<_Dur2, _Dur>>>
569 constexpr time_point(const time_point<clock, _Dur2>& __t)
570 : __d(__t.time_since_epoch())
575 time_since_epoch() const
580 operator+=(const duration& __dur)
587 operator-=(const duration& __dur)
594 static constexpr time_point
596 { return time_point(duration::min()); }
598 static constexpr time_point
600 { return time_point(duration::max()); }
607 template<typename _ToDur, typename _Clock, typename _Dur>
608 constexpr typename enable_if<__is_duration<_ToDur>::value,
609 time_point<_Clock, _ToDur>>::type
610 time_point_cast(const time_point<_Clock, _Dur>& __t)
612 typedef time_point<_Clock, _ToDur> __time_point;
613 return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
616 template<typename _Clock, typename _Dur1,
617 typename _Rep2, typename _Period2>
618 constexpr time_point<_Clock,
619 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
620 operator+(const time_point<_Clock, _Dur1>& __lhs,
621 const duration<_Rep2, _Period2>& __rhs)
623 typedef duration<_Rep2, _Period2> __dur2;
624 typedef typename common_type<_Dur1,__dur2>::type __ct;
625 typedef time_point<_Clock, __ct> __time_point;
626 return __time_point(__lhs.time_since_epoch() + __rhs);
629 template<typename _Rep1, typename _Period1,
630 typename _Clock, typename _Dur2>
631 constexpr time_point<_Clock,
632 typename common_type<duration<_Rep1, _Period1>, _Dur2>::type>
633 operator+(const duration<_Rep1, _Period1>& __lhs,
634 const time_point<_Clock, _Dur2>& __rhs)
636 typedef duration<_Rep1, _Period1> __dur1;
637 typedef typename common_type<__dur1,_Dur2>::type __ct;
638 typedef time_point<_Clock, __ct> __time_point;
639 return __time_point(__rhs.time_since_epoch() + __lhs);
642 template<typename _Clock, typename _Dur1,
643 typename _Rep2, typename _Period2>
644 constexpr time_point<_Clock,
645 typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
646 operator-(const time_point<_Clock, _Dur1>& __lhs,
647 const duration<_Rep2, _Period2>& __rhs)
649 typedef duration<_Rep2, _Period2> __dur2;
650 typedef typename common_type<_Dur1,__dur2>::type __ct;
651 typedef time_point<_Clock, __ct> __time_point;
652 return __time_point(__lhs.time_since_epoch() -__rhs);
655 template<typename _Clock, typename _Dur1, typename _Dur2>
656 constexpr typename common_type<_Dur1, _Dur2>::type
657 operator-(const time_point<_Clock, _Dur1>& __lhs,
658 const time_point<_Clock, _Dur2>& __rhs)
659 { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
661 template<typename _Clock, typename _Dur1, typename _Dur2>
663 operator==(const time_point<_Clock, _Dur1>& __lhs,
664 const time_point<_Clock, _Dur2>& __rhs)
665 { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
667 template<typename _Clock, typename _Dur1, typename _Dur2>
669 operator!=(const time_point<_Clock, _Dur1>& __lhs,
670 const time_point<_Clock, _Dur2>& __rhs)
671 { return !(__lhs == __rhs); }
673 template<typename _Clock, typename _Dur1, typename _Dur2>
675 operator<(const time_point<_Clock, _Dur1>& __lhs,
676 const time_point<_Clock, _Dur2>& __rhs)
677 { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
679 template<typename _Clock, typename _Dur1, typename _Dur2>
681 operator<=(const time_point<_Clock, _Dur1>& __lhs,
682 const time_point<_Clock, _Dur2>& __rhs)
683 { return !(__rhs < __lhs); }
685 template<typename _Clock, typename _Dur1, typename _Dur2>
687 operator>(const time_point<_Clock, _Dur1>& __lhs,
688 const time_point<_Clock, _Dur2>& __rhs)
689 { return __rhs < __lhs; }
691 template<typename _Clock, typename _Dur1, typename _Dur2>
693 operator>=(const time_point<_Clock, _Dur1>& __lhs,
694 const time_point<_Clock, _Dur2>& __rhs)
695 { return !(__lhs < __rhs); }
700 // Why nanosecond resolution as the default?
701 // Why have std::system_clock always count in the higest
702 // resolution (ie nanoseconds), even if on some OSes the low 3
703 // or 9 decimal digits will be always zero? This allows later
704 // implementations to change the system_clock::now()
705 // implementation any time to provide better resolution without
706 // changing function signature or units.
708 // To support the (forward) evolution of the library's defined
709 // clocks, wrap inside inline namespace so that the current
710 // defintions of system_clock, steady_clock, and
711 // high_resolution_clock types are uniquely mangled. This way, new
712 // code can use the latests clocks, while the library can contain
713 // compatibility definitions for previous versions. At some
714 // point, when these clocks settle down, the inlined namespaces
715 // can be removed. XXX GLIBCXX_ABI Deprecated
716 inline namespace _V2 {
719 * @brief System clock.
721 * Time returned represents wall time from the system-wide clock.
725 typedef chrono::nanoseconds duration;
726 typedef duration::rep rep;
727 typedef duration::period period;
728 typedef chrono::time_point<system_clock, duration> time_point;
730 static_assert(system_clock::duration::min()
731 < system_clock::duration::zero(),
732 "a clock's minimum duration cannot be less than its epoch");
734 static constexpr bool is_steady = false;
741 to_time_t(const time_point& __t) noexcept
743 return std::time_t(duration_cast<chrono::seconds>
744 (__t.time_since_epoch()).count());
748 from_time_t(std::time_t __t) noexcept
750 typedef chrono::time_point<system_clock, seconds> __from;
751 return time_point_cast<system_clock::duration>
752 (__from(chrono::seconds(__t)));
758 * @brief Monotonic clock
760 * Time returned has the property of only increasing at a uniform rate.
764 typedef chrono::nanoseconds duration;
765 typedef duration::rep rep;
766 typedef duration::period period;
767 typedef chrono::time_point<steady_clock, duration> time_point;
769 static constexpr bool is_steady = true;
777 * @brief Highest-resolution clock
779 * This is the clock "with the shortest tick period." Alias to
780 * std::system_clock until higher-than-nanosecond definitions
783 using high_resolution_clock = system_clock;
785 } // end inline namespace _V2
787 _GLIBCXX_END_NAMESPACE_VERSION
788 } // namespace chrono
790#if __cplusplus > 201103L
792#define __cpp_lib_chrono_udls 201304
794 inline namespace literals
796 inline namespace chrono_literals
798 _GLIBCXX_BEGIN_NAMESPACE_VERSION
800 template<typename _Rep, unsigned long long _Val>
801 struct _Checked_integral_constant
802 : integral_constant<_Rep, static_cast<_Rep>(_Val)>
804 static_assert(_Checked_integral_constant::value >= 0
805 && _Checked_integral_constant::value == _Val,
806 "literal value cannot be represented by duration type");
809 template<typename _Dur, char... _Digits>
810 constexpr _Dur __check_overflow()
812 using _Val = __parse_int::_Parse_int<_Digits...>;
813 using _Rep = typename _Dur::rep;
814 // TODO: should be simply integral_constant<_Rep, _Val::value>
815 // but GCC doesn't reject narrowing conversions to _Rep.
816 using _CheckedVal = _Checked_integral_constant<_Rep, _Val::value>;
817 return _Dur{_CheckedVal::value};
820 constexpr chrono::duration<long double, ratio<3600,1>>
821 operator""h(long double __hours)
822 { return chrono::duration<long double, ratio<3600,1>>{__hours}; }
824 template <char... _Digits>
825 constexpr chrono::hours
827 { return __check_overflow<chrono::hours, _Digits...>(); }
829 constexpr chrono::duration<long double, ratio<60,1>>
830 operator""min(long double __mins)
831 { return chrono::duration<long double, ratio<60,1>>{__mins}; }
833 template <char... _Digits>
834 constexpr chrono::minutes
836 { return __check_overflow<chrono::minutes, _Digits...>(); }
838 constexpr chrono::duration<long double>
839 operator""s(long double __secs)
840 { return chrono::duration<long double>{__secs}; }
842 template <char... _Digits>
843 constexpr chrono::seconds
845 { return __check_overflow<chrono::seconds, _Digits...>(); }
847 constexpr chrono::duration<long double, milli>
848 operator""ms(long double __msecs)
849 { return chrono::duration<long double, milli>{__msecs}; }
851 template <char... _Digits>
852 constexpr chrono::milliseconds
854 { return __check_overflow<chrono::milliseconds, _Digits...>(); }
856 constexpr chrono::duration<long double, micro>
857 operator""us(long double __usecs)
858 { return chrono::duration<long double, micro>{__usecs}; }
860 template <char... _Digits>
861 constexpr chrono::microseconds
863 { return __check_overflow<chrono::microseconds, _Digits...>(); }
865 constexpr chrono::duration<long double, nano>
866 operator""ns(long double __nsecs)
867 { return chrono::duration<long double, nano>{__nsecs}; }
869 template <char... _Digits>
870 constexpr chrono::nanoseconds
872 { return __check_overflow<chrono::nanoseconds, _Digits...>(); }
874 _GLIBCXX_END_NAMESPACE_VERSION
875 } // inline namespace chrono_literals
876 } // inline namespace literals
880 _GLIBCXX_BEGIN_NAMESPACE_VERSION
882 using namespace literals::chrono_literals;
884 _GLIBCXX_END_NAMESPACE_VERSION
885 } // namespace chrono
887#endif // __cplusplus > 201103L
892#endif //_GLIBCXX_USE_C99_STDINT_TR1
896#endif //_GLIBCXX_CHRONO