111
111
duration d_; // exposition only
114
time_point(); // has value "epoch"
115
explicit time_point(const duration& d); // same as time_point() + d
114
time_point(); // has value "epoch" // constexpr in C++14
115
explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14
118
118
template <class Duration2>
119
time_point(const time_point<clock, Duration2>& t);
119
time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
123
duration time_since_epoch() const;
123
duration time_since_epoch() const; // constexpr in C++14
194
194
template <class ToDuration, class Rep, class Period>
195
195
ToDuration duration_cast(const duration<Rep, Period>& d);
197
// time_point arithmetic
197
// time_point arithmetic (all constexpr in C++14)
198
198
template <class Clock, class Duration1, class Rep2, class Period2>
199
199
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
200
200
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
208
208
typename common_type<Duration1, Duration2>::type
209
209
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
211
// time_point comparisons
211
// time_point comparisons (all constexpr in C++14)
212
212
template <class Clock, class Duration1, class Duration2>
213
213
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
214
214
template <class Clock, class Duration1, class Duration2>
222
222
template <class Clock, class Duration1, class Duration2>
223
223
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
225
// time_point_cast (constexpr in C++14)
227
227
template <class ToDuration, class Clock, class Duration>
228
228
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
236
236
typedef duration::rep rep;
237
237
typedef duration::period period;
238
238
typedef chrono::time_point<system_clock> time_point;
239
static const bool is_steady = false;
239
static const bool is_steady = false; // constexpr in C++14
241
241
static time_point now() noexcept;
242
242
static time_t to_time_t (const time_point& __t) noexcept;
250
250
typedef duration::rep rep;
251
251
typedef duration::period period;
252
252
typedef chrono::time_point<steady_clock, duration> time_point;
253
static const bool is_steady = true;
253
static const bool is_steady = true; // constexpr in C++14
255
255
static time_point now() noexcept;
262
constexpr chrono::hours operator "" h(unsigned long long); // C++14
263
constexpr chrono::duration<unspecified , ratio<3600,1>> operator "" h(long double); // C++14
264
constexpr chrono::minutes operator "" min(unsigned long long); // C++14
265
constexpr chrono::duration<unspecified , ratio<60,1>> operator "" min(long double); // C++14
266
constexpr chrono::seconds operator "" s(unsigned long long); // C++14
267
constexpr chrono::duration<unspecified > operator "" s(long double); // C++14
268
constexpr chrono::milliseconds operator "" ms(unsigned long long); // C++14
269
constexpr chrono::duration<unspecified , milli> operator "" ms(long double); // C++14
270
constexpr chrono::microseconds operator "" us(unsigned long long); // C++14
271
constexpr chrono::duration<unspecified , micro> operator "" us(long double); // C++14
272
constexpr chrono::nanoseconds operator "" ns(unsigned long long); // C++14
273
constexpr chrono::duration<unspecified , nano> operator "" ns(long double); // C++14
406
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default;
419
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
420
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
421
duration() = default;
407
426
template <class _Rep2>
408
427
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
409
428
explicit duration(const _Rep2& __r,
468
487
struct __duration_eq
470
489
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
471
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
490
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
473
492
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
474
493
return _Ct(__lhs).count() == _Ct(__rhs).count();
479
498
struct __duration_eq<_LhsDuration, _LhsDuration>
481
500
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
482
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
501
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
483
502
{return __lhs.count() == __rhs.count();}
509
528
struct __duration_lt
511
530
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
512
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
531
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
514
533
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
515
534
return _Ct(__lhs).count() < _Ct(__rhs).count();
520
539
struct __duration_lt<_LhsDuration, _LhsDuration>
522
541
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
523
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
542
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
524
543
{return __lhs.count() < __rhs.count();}
712
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
713
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
731
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {}
732
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {}
716
735
template <class _Duration2>
717
_LIBCPP_INLINE_VISIBILITY
736
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
718
737
time_point(const time_point<clock, _Duration2>& t,
719
738
typename enable_if
727
_LIBCPP_INLINE_VISIBILITY duration time_since_epoch() const {return __d_;}
746
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;}
731
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
732
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
750
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
751
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
734
753
// special values
749
768
namespace chrono {
751
770
template <class _ToDuration, class _Clock, class _Duration>
752
inline _LIBCPP_INLINE_VISIBILITY
771
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
753
772
time_point<_Clock, _ToDuration>
754
773
time_point_cast(const time_point<_Clock, _Duration>& __t)
761
780
template <class _Clock, class _Duration1, class _Duration2>
762
inline _LIBCPP_INLINE_VISIBILITY
781
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
764
783
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
771
790
template <class _Clock, class _Duration1, class _Duration2>
772
inline _LIBCPP_INLINE_VISIBILITY
791
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
774
793
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
781
800
template <class _Clock, class _Duration1, class _Duration2>
782
inline _LIBCPP_INLINE_VISIBILITY
801
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
784
803
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
791
810
template <class _Clock, class _Duration1, class _Duration2>
792
inline _LIBCPP_INLINE_VISIBILITY
811
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
794
813
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
801
820
template <class _Clock, class _Duration1, class _Duration2>
802
inline _LIBCPP_INLINE_VISIBILITY
821
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
804
823
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
811
830
template <class _Clock, class _Duration1, class _Duration2>
812
inline _LIBCPP_INLINE_VISIBILITY
831
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
814
833
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
819
838
// time_point operator+(time_point x, duration y);
821
840
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
822
inline _LIBCPP_INLINE_VISIBILITY
841
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
823
842
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
824
843
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
826
845
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
827
_Tr __r(__lhs.time_since_epoch());
846
return _Tr (__lhs.time_since_epoch() + __rhs);
832
849
// time_point operator+(duration x, time_point y);
834
851
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
835
inline _LIBCPP_INLINE_VISIBILITY
852
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
836
853
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
837
854
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
842
859
// time_point operator-(time_point x, duration y);
844
861
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
845
inline _LIBCPP_INLINE_VISIBILITY
862
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
846
863
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
847
864
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
852
869
// duration operator-(time_point x, time_point y);
854
871
template <class _Clock, class _Duration1, class _Duration2>
855
inline _LIBCPP_INLINE_VISIBILITY
872
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
856
873
typename common_type<_Duration1, _Duration2>::type
857
874
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
870
887
typedef duration::rep rep;
871
888
typedef duration::period period;
872
889
typedef chrono::time_point<system_clock> time_point;
873
static const bool is_steady = false;
890
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
875
892
static time_point now() _NOEXCEPT;
876
893
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
884
901
typedef duration::rep rep;
885
902
typedef duration::period period;
886
903
typedef chrono::time_point<steady_clock, duration> time_point;
887
static const bool is_steady = true;
904
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true;
889
906
static time_point now() _NOEXCEPT;
913
#if _LIBCPP_STD_VER > 11
914
// Literal suffixes for chrono types
915
// inline // Deviation from N3690.
916
// We believe the inline to be a defect and have submitted an LWG issue.
917
// An LWG issue number has not yet been assigned.
920
inline namespace chrono_literals
923
constexpr chrono::hours operator"" h(unsigned long long __h)
925
return chrono::hours(static_cast<chrono::hours::rep>(__h));
928
constexpr chrono::duration<long double, ratio<3600,1>> operator"" h(long double __h)
930
return chrono::duration<long double, ratio<3600,1>>(__h);
934
constexpr chrono::minutes operator"" min(unsigned long long __m)
936
return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
939
constexpr chrono::duration<long double, ratio<60,1>> operator"" min(long double __m)
941
return chrono::duration<long double, ratio<60,1>> (__m);
945
constexpr chrono::seconds operator"" s(unsigned long long __s)
947
return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
950
constexpr chrono::duration<long double> operator"" s(long double __s)
952
return chrono::duration<long double> (__s);
956
constexpr chrono::milliseconds operator"" ms(unsigned long long __ms)
958
return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
961
constexpr chrono::duration<long double, milli> operator"" ms(long double __ms)
963
return chrono::duration<long double, milli>(__ms);
967
constexpr chrono::microseconds operator"" us(unsigned long long __us)
969
return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
972
constexpr chrono::duration<long double, micro> operator"" us(long double __us)
974
return chrono::duration<long double, micro> (__us);
978
constexpr chrono::nanoseconds operator"" ns(unsigned long long __ns)
980
return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
983
constexpr chrono::duration<long double, nano> operator"" ns(long double __ns)
985
return chrono::duration<long double, nano> (__ns);
896
991
_LIBCPP_END_NAMESPACE_STD
898
993
#endif // _LIBCPP_CHRONO