1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CHRONO_DURATION_H
11#define _LIBCPP___CHRONO_DURATION_H
12
13#include <__compare/ordering.h>
14#include <__compare/three_way_comparable.h>
15#include <__config>
16#include <__cstddef/size_t.h>
17#include <__functional/hash.h>
18#include <__type_traits/common_type.h>
19#include <__type_traits/enable_if.h>
20#include <__type_traits/is_convertible.h>
21#include <__type_traits/is_floating_point.h>
22#include <__type_traits/is_unqualified.h>
23#include <limits>
24#include <ratio>
25
26#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
27# pragma GCC system_header
28#endif
29
30_LIBCPP_PUSH_MACROS
31#include <__undef_macros>
32
33_LIBCPP_BEGIN_NAMESPACE_STD
34
35namespace chrono {
36
37template <class _Rep, class _Period = ratio<1> >
38class duration;
39
40template <class _Tp>
41inline const bool __is_duration_v = false;
42
43template <class _Rep, class _Period>
44inline const bool __is_duration_v<duration<_Rep, _Period> > = true;
45
46template <class _Rep, class _Period>
47inline const bool __is_duration_v<const duration<_Rep, _Period> > = true;
48
49template <class _Rep, class _Period>
50inline const bool __is_duration_v<volatile duration<_Rep, _Period> > = true;
51
52template <class _Rep, class _Period>
53inline const bool __is_duration_v<const volatile duration<_Rep, _Period> > = true;
54
55} // namespace chrono
56
57template <class _Rep1, class _Period1, class _Rep2, class _Period2>
58struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> > {
59 typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, __ratio_gcd<_Period1, _Period2> > type;
60};
61
62namespace chrono {
63
64// duration_cast
65
66template <class _FromDuration,
67 class _ToDuration,
68 class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type,
69 bool = _Period::num == 1,
70 bool = _Period::den == 1>
71struct __duration_cast;
72
73template <class _FromDuration, class _ToDuration, class _Period>
74struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> {
75 _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
76 return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
77 }
78};
79
80template <class _FromDuration, class _ToDuration, class _Period>
81struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> {
82 _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
83 typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
84 return _ToDuration(
85 static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
86 }
87};
88
89template <class _FromDuration, class _ToDuration, class _Period>
90struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> {
91 _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
92 typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
93 return _ToDuration(
94 static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
95 }
96};
97
98template <class _FromDuration, class _ToDuration, class _Period>
99struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> {
100 _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
101 typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
102 return _ToDuration(static_cast<typename _ToDuration::rep>(
103 static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num) / static_cast<_Ct>(_Period::den)));
104 }
105};
106
107template <class _ToDuration, class _Rep, class _Period, __enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
108[[__nodiscard__]] inline _LIBCPP_CONSTEXPR _ToDuration duration_cast(const duration<_Rep, _Period>& __fd) {
109 return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
110}
111
112template <class _Rep>
113struct treat_as_floating_point : is_floating_point<_Rep> {};
114
115#if _LIBCPP_STD_VER >= 17
116template <class _Rep>
117inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>::value;
118#endif
119
120template <class _Rep>
121struct duration_values {
122public:
123 [[__nodiscard__]] static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT { return _Rep(0); }
124 [[__nodiscard__]] static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT { return numeric_limits<_Rep>::max(); }
125 [[__nodiscard__]] static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT { return numeric_limits<_Rep>::lowest(); }
126};
127
128template <class _ToDuration, class _Rep, class _Period>
129_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration __ceil(const duration<_Rep, _Period>& __d) {
130 _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
131 if (__t < __d)
132 __t = __t + _ToDuration(1);
133 return __t;
134}
135
136#if _LIBCPP_STD_VER >= 17
137template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
138[[__nodiscard__]] inline _LIBCPP_CONSTEXPR _ToDuration floor(const duration<_Rep, _Period>& __d) {
139 _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
140 if (__t > __d)
141 __t = __t - _ToDuration{1};
142 return __t;
143}
144
145template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
146[[__nodiscard__]] inline _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_Rep, _Period>& __d) {
147 return chrono::__ceil<_ToDuration>(__d);
148}
149
150template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
151[[__nodiscard__]] inline _LIBCPP_CONSTEXPR _ToDuration round(const duration<_Rep, _Period>& __d) {
152 _ToDuration __lower = chrono::floor<_ToDuration>(__d);
153 _ToDuration __upper = __lower + _ToDuration{1};
154 auto __lower_diff = __d - __lower;
155 auto __upper_diff = __upper - __d;
156 if (__lower_diff < __upper_diff)
157 return __lower;
158 if (__lower_diff > __upper_diff)
159 return __upper;
160 return __lower.count() & 1 ? __upper : __lower;
161}
162#endif
163
164// duration
165
166template <class _Rep, class _Period>
167class duration {
168 static_assert(__is_unqualified_v<_Rep>, "A duration representation cannot be qualified");
169 static_assert(!__is_duration_v<_Rep>, "A duration representation can not be a duration");
170 static_assert(__is_ratio_v<_Period>, "Second template parameter of duration must be a std::ratio");
171 static_assert(_Period::num > 0, "duration period must be positive");
172
173 template <class _R1, class _R2>
174 struct __no_overflow {
175 private:
176 static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>;
177 static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>;
178 static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
179 static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
180 static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
181 static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
182 static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
183
184 template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
185 struct __mul // __overflow == false
186 {
187 static const intmax_t value = _Xp * _Yp;
188 };
189
190 template <intmax_t _Xp, intmax_t _Yp>
191 struct __mul<_Xp, _Yp, true> {
192 static const intmax_t value = 1;
193 };
194
195 public:
196 static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
197 typedef ratio<__mul<__n1, __d2, !value>::value, __mul<__n2, __d1, !value>::value> type;
198 };
199
200public:
201 typedef _Rep rep;
202 typedef typename _Period::type period;
203
204private:
205 rep __rep_;
206
207public:
208#ifndef _LIBCPP_CXX03_LANG
209 constexpr duration() = default;
210#else
211 duration() {}
212#endif
213
214 template <class _Rep2,
215 __enable_if_t<is_convertible<const _Rep2&, rep>::value &&
216 (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value),
217 int> = 0>
218 _LIBCPP_CONSTEXPR explicit duration(const _Rep2& __r) : __rep_(__r) {}
219
220 // conversions
221 template <class _Rep2,
222 class _Period2,
223 __enable_if_t<__no_overflow<_Period2, period>::value && (treat_as_floating_point<rep>::value ||
224 (__no_overflow<_Period2, period>::type::den == 1 &&
225 !treat_as_floating_point<_Rep2>::value)),
226 int> = 0>
227 _LIBCPP_CONSTEXPR duration(const duration<_Rep2, _Period2>& __d)
228 : __rep_(chrono::duration_cast<duration>(__d).count()) {}
229
230 // observer
231
232 [[__nodiscard__]] _LIBCPP_CONSTEXPR rep count() const { return __rep_; }
233
234 // arithmetic
235
236 [[__nodiscard__]] _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {
237 return typename common_type<duration>::type(*this);
238 }
239 [[__nodiscard__]] _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {
240 return typename common_type<duration>::type(-__rep_);
241 }
242 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {
243 ++__rep_;
244 return *this;
245 }
246 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator++(int) { return duration(__rep_++); }
247 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator--() {
248 --__rep_;
249 return *this;
250 }
251 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator--(int) { return duration(__rep_--); }
252
253 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator+=(const duration& __d) {
254 __rep_ += __d.count();
255 return *this;
256 }
257 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator-=(const duration& __d) {
258 __rep_ -= __d.count();
259 return *this;
260 }
261
262 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator*=(const rep& __rhs) {
263 __rep_ *= __rhs;
264 return *this;
265 }
266 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator/=(const rep& __rhs) {
267 __rep_ /= __rhs;
268 return *this;
269 }
270 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const rep& __rhs) {
271 __rep_ %= __rhs;
272 return *this;
273 }
274 _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const duration& __rhs) {
275 __rep_ %= __rhs.count();
276 return *this;
277 }
278
279 // special values
280
281 [[__nodiscard__]] static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {
282 return duration(duration_values<rep>::zero());
283 }
284 [[__nodiscard__]] static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT { return duration(duration_values<rep>::min()); }
285 [[__nodiscard__]] static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT { return duration(duration_values<rep>::max()); }
286};
287
288typedef duration<long long, nano> nanoseconds;
289typedef duration<long long, micro> microseconds;
290typedef duration<long long, milli> milliseconds;
291typedef duration<long long > seconds;
292typedef duration<long, ratio<60> > minutes;
293typedef duration<long, ratio<60 * 60> > hours;
294#if _LIBCPP_STD_VER >= 20
295typedef duration<int, ratio<60 * 60 * 24>> days;
296typedef duration<int, ratio<60 * 60 * 24 * 7>> weeks;
297typedef duration<int, ratio<31556952>> years; // 365.2425 * 60 * 60 * 24
298typedef duration<int, ratio<2629746>> months; // years / 12
299#endif
300// Duration ==
301
302template <class _Rep1, class _Period1, class _Rep2, class _Period2>
303inline _LIBCPP_CONSTEXPR bool
304operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
305 using _Ct = typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type;
306 return _Ct(__lhs).count() == _Ct(__rhs).count();
307}
308
309#if _LIBCPP_STD_VER <= 17
310
311// Duration !=
312
313template <class _Rep1, class _Period1, class _Rep2, class _Period2>
314inline _LIBCPP_CONSTEXPR bool
315operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
316 return !(__lhs == __rhs);
317}
318
319#endif // _LIBCPP_STD_VER <= 17
320
321// Duration <
322
323template <class _Rep1, class _Period1, class _Rep2, class _Period2>
324inline _LIBCPP_CONSTEXPR bool
325operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
326 using _Ct = typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type;
327 return _Ct(__lhs).count() < _Ct(__rhs).count();
328}
329
330// Duration >
331
332template <class _Rep1, class _Period1, class _Rep2, class _Period2>
333inline _LIBCPP_CONSTEXPR bool
334operator>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
335 return __rhs < __lhs;
336}
337
338// Duration <=
339
340template <class _Rep1, class _Period1, class _Rep2, class _Period2>
341inline _LIBCPP_CONSTEXPR bool
342operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
343 return !(__rhs < __lhs);
344}
345
346// Duration >=
347
348template <class _Rep1, class _Period1, class _Rep2, class _Period2>
349inline _LIBCPP_CONSTEXPR bool
350operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
351 return !(__lhs < __rhs);
352}
353
354#if _LIBCPP_STD_VER >= 20
355
356template <class _Rep1, class _Period1, class _Rep2, class _Period2>
357 requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
358constexpr auto operator<=>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
359 using _Ct = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>;
360 return _Ct(__lhs).count() <=> _Ct(__rhs).count();
361}
362
363#endif // _LIBCPP_STD_VER >= 20
364
365// Duration +
366
367template <class _Rep1, class _Period1, class _Rep2, class _Period2>
368[[__nodiscard__]] inline _LIBCPP_CONSTEXPR
369typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
370operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
371 typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
372 return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
373}
374
375// Duration -
376
377template <class _Rep1, class _Period1, class _Rep2, class _Period2>
378[[__nodiscard__]] inline _LIBCPP_CONSTEXPR
379typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
380operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
381 typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
382 return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
383}
384
385// Duration *
386
387template <class _Rep1,
388 class _Period,
389 class _Rep2,
390 __enable_if_t<is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
391[[__nodiscard__]] inline _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
392operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
393 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
394 typedef duration<_Cr, _Period> _Cd;
395 return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
396}
397
398template <class _Rep1,
399 class _Period,
400 class _Rep2,
401 __enable_if_t<is_convertible<const _Rep1&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
402[[__nodiscard__]] inline _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
403operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) {
404 return __d * __s;
405}
406
407// Duration /
408
409template <class _Rep1,
410 class _Period,
411 class _Rep2,
412 __enable_if_t<!__is_duration_v<_Rep2> &&
413 is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
414 int> = 0>
415[[__nodiscard__]] inline _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
416operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
417 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
418 typedef duration<_Cr, _Period> _Cd;
419 return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
420}
421
422template <class _Rep1, class _Period1, class _Rep2, class _Period2>
423[[__nodiscard__]] inline _LIBCPP_CONSTEXPR typename common_type<_Rep1, _Rep2>::type
424operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
425 typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
426 return _Ct(__lhs).count() / _Ct(__rhs).count();
427}
428
429// Duration %
430
431template <class _Rep1,
432 class _Period,
433 class _Rep2,
434 __enable_if_t<!__is_duration_v<_Rep2> &&
435 is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
436 int> = 0>
437[[__nodiscard__]] inline _LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
438operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
439 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
440 typedef duration<_Cr, _Period> _Cd;
441 return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
442}
443
444template <class _Rep1, class _Period1, class _Rep2, class _Period2>
445[[__nodiscard__]] inline _LIBCPP_CONSTEXPR
446typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
447operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
448 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
449 typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
450 return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
451}
452
453} // namespace chrono
454
455#if _LIBCPP_STD_VER >= 14
456// Suffixes for duration literals [time.duration.literals]
457inline namespace literals {
458inline namespace chrono_literals {
459
460[[__nodiscard__]] constexpr chrono::hours operator""h(unsigned long long __h) {
461 return chrono::hours(static_cast<chrono::hours::rep>(__h));
462}
463
464[[__nodiscard__]] constexpr chrono::duration<long double, ratio<3600, 1>> operator""h(long double __h) {
465 return chrono::duration<long double, ratio<3600, 1>>(__h);
466}
467
468[[__nodiscard__]] constexpr chrono::minutes operator""min(unsigned long long __m) {
469 return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
470}
471
472[[__nodiscard__]] constexpr chrono::duration<long double, ratio<60, 1>> operator""min(long double __m) {
473 return chrono::duration<long double, ratio<60, 1>>(__m);
474}
475
476[[__nodiscard__]] constexpr chrono::seconds operator""s(unsigned long long __s) {
477 return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
478}
479
480[[__nodiscard__]] constexpr chrono::duration<long double> operator""s(long double __s) {
481 return chrono::duration<long double>(__s);
482}
483
484[[__nodiscard__]] constexpr chrono::milliseconds operator""ms(unsigned long long __ms) {
485 return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
486}
487
488[[__nodiscard__]] constexpr chrono::duration<long double, milli> operator""ms(long double __ms) {
489 return chrono::duration<long double, milli>(__ms);
490}
491
492[[__nodiscard__]] constexpr chrono::microseconds operator""us(unsigned long long __us) {
493 return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
494}
495
496[[__nodiscard__]] constexpr chrono::duration<long double, micro> operator""us(long double __us) {
497 return chrono::duration<long double, micro>(__us);
498}
499
500[[__nodiscard__]] constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) {
501 return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
502}
503
504[[__nodiscard__]] constexpr chrono::duration<long double, nano> operator""ns(long double __ns) {
505 return chrono::duration<long double, nano>(__ns);
506}
507
508} // namespace chrono_literals
509} // namespace literals
510
511namespace chrono { // hoist the literals into namespace std::chrono
512using namespace literals::chrono_literals;
513} // namespace chrono
514
515#endif // _LIBCPP_STD_VER >= 14
516
517#if _LIBCPP_STD_VER >= 26
518
519template <class _Rep, class _Period>
520 requires __has_enabled_hash<_Rep>::value
521struct hash<chrono::duration<_Rep, _Period>> {
522 [[nodiscard]] static size_t operator()(const chrono::duration<_Rep, _Period>& __d) {
523 return hash<_Rep>{}(__d.count());
524 }
525};
526
527#endif // _LIBCPP_STD_VER >= 26
528
529_LIBCPP_END_NAMESPACE_STD
530
531_LIBCPP_POP_MACROS
532
533#endif // _LIBCPP___CHRONO_DURATION_H
534