2 //===----------------------------------------------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_CHRONO
11 #define _LIBCPP_CHRONO
21 template <class ToDuration, class Rep, class Period>
24 duration_cast(const duration<Rep, Period>& fd);
26 template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
28 template <class Rep> inline constexpr bool treat_as_floating_point_v
29 = treat_as_floating_point<Rep>::value; // C++17
32 struct duration_values
35 static constexpr Rep zero(); // noexcept in C++20
36 static constexpr Rep max(); // noexcept in C++20
37 static constexpr Rep min(); // noexcept in C++20
42 template <class Rep, class Period = ratio<1>>
45 static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration");
46 static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio");
47 static_assert(Period::num > 0, "duration period must be positive");
50 typedef typename _Period::type period;
52 constexpr duration() = default;
54 constexpr explicit duration(const Rep2& r,
57 is_convertible<Rep2, rep>::value &&
58 (treat_as_floating_point<rep>::value ||
59 !treat_as_floating_point<rep>::value && !treat_as_floating_point<Rep2>::value)
63 template <class Rep2, class Period2>
64 constexpr duration(const duration<Rep2, Period2>& d,
67 treat_as_floating_point<rep>::value ||
68 ratio_divide<Period2, period>::type::den == 1
73 constexpr rep count() const;
77 constexpr common_type<duration>::type operator+() const;
78 constexpr common_type<duration>::type operator-() const;
79 constexpr duration& operator++(); // constexpr in C++17
80 constexpr duration operator++(int); // constexpr in C++17
81 constexpr duration& operator--(); // constexpr in C++17
82 constexpr duration operator--(int); // constexpr in C++17
84 constexpr duration& operator+=(const duration& d); // constexpr in C++17
85 constexpr duration& operator-=(const duration& d); // constexpr in C++17
87 duration& operator*=(const rep& rhs); // constexpr in C++17
88 duration& operator/=(const rep& rhs); // constexpr in C++17
89 duration& operator%=(const rep& rhs); // constexpr in C++17
90 duration& operator%=(const duration& rhs); // constexpr in C++17
94 static constexpr duration zero(); // noexcept in C++20
95 static constexpr duration min(); // noexcept in C++20
96 static constexpr duration max(); // noexcept in C++20
99 typedef duration<long long, nano> nanoseconds;
100 typedef duration<long long, micro> microseconds;
101 typedef duration<long long, milli> milliseconds;
102 typedef duration<long long > seconds;
103 typedef duration< long, ratio< 60> > minutes;
104 typedef duration< long, ratio<3600> > hours;
106 template <class Clock, class Duration = typename Clock::duration>
111 typedef Duration duration;
112 typedef typename duration::rep rep;
113 typedef typename duration::period period;
115 duration d_; // exposition only
118 time_point(); // has value "epoch" // constexpr in C++14
119 explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14
122 template <class Duration2>
123 time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
127 duration time_since_epoch() const; // constexpr in C++14
131 time_point& operator+=(const duration& d); // constexpr in C++17
132 time_point& operator-=(const duration& d); // constexpr in C++17
136 static constexpr time_point min(); // noexcept in C++20
137 static constexpr time_point max(); // noexcept in C++20
142 // common_type traits
143 template <class Rep1, class Period1, class Rep2, class Period2>
144 struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>;
146 template <class Clock, class Duration1, class Duration2>
147 struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>;
151 // duration arithmetic
152 template <class Rep1, class Period1, class Rep2, class Period2>
154 typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
155 operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
156 template <class Rep1, class Period1, class Rep2, class Period2>
158 typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
159 operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
160 template <class Rep1, class Period, class Rep2>
162 duration<typename common_type<Rep1, Rep2>::type, Period>
163 operator*(const duration<Rep1, Period>& d, const Rep2& s);
164 template <class Rep1, class Period, class Rep2>
166 duration<typename common_type<Rep1, Rep2>::type, Period>
167 operator*(const Rep1& s, const duration<Rep2, Period>& d);
168 template <class Rep1, class Period, class Rep2>
170 duration<typename common_type<Rep1, Rep2>::type, Period>
171 operator/(const duration<Rep1, Period>& d, const Rep2& s);
172 template <class Rep1, class Period1, class Rep2, class Period2>
174 typename common_type<Rep1, Rep2>::type
175 operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
177 // duration comparisons
178 template <class Rep1, class Period1, class Rep2, class Period2>
180 bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
181 template <class Rep1, class Period1, class Rep2, class Period2>
183 bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
184 template <class Rep1, class Period1, class Rep2, class Period2>
186 bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
187 template <class Rep1, class Period1, class Rep2, class Period2>
189 bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
190 template <class Rep1, class Period1, class Rep2, class Period2>
192 bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
193 template <class Rep1, class Period1, class Rep2, class Period2>
195 bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
198 template <class ToDuration, class Rep, class Period>
199 ToDuration duration_cast(const duration<Rep, Period>& d);
201 template <class ToDuration, class Rep, class Period>
202 constexpr ToDuration floor(const duration<Rep, Period>& d); // C++17
203 template <class ToDuration, class Rep, class Period>
204 constexpr ToDuration ceil(const duration<Rep, Period>& d); // C++17
205 template <class ToDuration, class Rep, class Period>
206 constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
208 // duration I/O is elsewhere
210 // time_point arithmetic (all constexpr in C++14)
211 template <class Clock, class Duration1, class Rep2, class Period2>
212 time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
213 operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
214 template <class Rep1, class Period1, class Clock, class Duration2>
215 time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
216 operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
217 template <class Clock, class Duration1, class Rep2, class Period2>
218 time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
219 operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
220 template <class Clock, class Duration1, class Duration2>
221 typename common_type<Duration1, Duration2>::type
222 operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
224 // time_point comparisons (all constexpr in C++14)
225 template <class Clock, class Duration1, class Duration2>
226 bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
227 template <class Clock, class Duration1, class Duration2>
228 bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
229 template <class Clock, class Duration1, class Duration2>
230 bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
231 template <class Clock, class Duration1, class Duration2>
232 bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
233 template <class Clock, class Duration1, class Duration2>
234 bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
235 template <class Clock, class Duration1, class Duration2>
236 bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
238 // time_point_cast (constexpr in C++14)
240 template <class ToDuration, class Clock, class Duration>
241 time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
243 template <class ToDuration, class Clock, class Duration>
244 constexpr time_point<Clock, ToDuration>
245 floor(const time_point<Clock, Duration>& tp); // C++17
247 template <class ToDuration, class Clock, class Duration>
248 constexpr time_point<Clock, ToDuration>
249 ceil(const time_point<Clock, Duration>& tp); // C++17
251 template <class ToDuration, class Clock, class Duration>
252 constexpr time_point<Clock, ToDuration>
253 round(const time_point<Clock, Duration>& tp); // C++17
255 template <class Rep, class Period>
256 constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17
263 typedef microseconds duration;
264 typedef duration::rep rep;
265 typedef duration::period period;
266 typedef chrono::time_point<system_clock> time_point;
267 static const bool is_steady = false; // constexpr in C++14
269 static time_point now() noexcept;
270 static time_t to_time_t (const time_point& __t) noexcept;
271 static time_point from_time_t(time_t __t) noexcept;
274 template <class Duration>
275 using sys_time = time_point<system_clock, Duration>; // C++20
276 using sys_seconds = sys_time<seconds>; // C++20
277 using sys_days = sys_time<days>; // C++20
279 class file_clock // C++20
282 typedef see-below rep;
284 typedef chrono::duration<rep, period> duration;
285 typedef chrono::time_point<file_clock> time_point;
286 static constexpr bool is_steady = false;
288 static time_point now() noexcept;
290 template<class Duration>
291 static sys_time<see-below> to_sys(const file_time<Duration>&);
293 template<class Duration>
294 static file_time<see-below> from_sys(const sys_time<Duration>&);
297 template<class Duration>
298 using file_time = time_point<file_clock, Duration>; // C++20
303 typedef nanoseconds duration;
304 typedef duration::rep rep;
305 typedef duration::period period;
306 typedef chrono::time_point<steady_clock, duration> time_point;
307 static const bool is_steady = true; // constexpr in C++14
309 static time_point now() noexcept;
312 typedef steady_clock high_resolution_clock;
314 // 25.7.8, local time // C++20
316 template<class Duration>
317 using local_time = time_point<local_t, Duration>;
318 using local_seconds = local_time<seconds>;
319 using local_days = local_time<days>;
321 // 25.8.2, class last_spec // C++20
324 // 25.8.3, class day // C++20
327 constexpr bool operator==(const day& x, const day& y) noexcept;
328 constexpr bool operator!=(const day& x, const day& y) noexcept;
329 constexpr bool operator< (const day& x, const day& y) noexcept;
330 constexpr bool operator> (const day& x, const day& y) noexcept;
331 constexpr bool operator<=(const day& x, const day& y) noexcept;
332 constexpr bool operator>=(const day& x, const day& y) noexcept;
333 constexpr day operator+(const day& x, const days& y) noexcept;
334 constexpr day operator+(const days& x, const day& y) noexcept;
335 constexpr day operator-(const day& x, const days& y) noexcept;
336 constexpr days operator-(const day& x, const day& y) noexcept;
338 // 25.8.4, class month // C++20
340 constexpr bool operator==(const month& x, const month& y) noexcept;
341 constexpr bool operator!=(const month& x, const month& y) noexcept;
342 constexpr bool operator< (const month& x, const month& y) noexcept;
343 constexpr bool operator> (const month& x, const month& y) noexcept;
344 constexpr bool operator<=(const month& x, const month& y) noexcept;
345 constexpr bool operator>=(const month& x, const month& y) noexcept;
346 constexpr month operator+(const month& x, const months& y) noexcept;
347 constexpr month operator+(const months& x, const month& y) noexcept;
348 constexpr month operator-(const month& x, const months& y) noexcept;
349 constexpr months operator-(const month& x, const month& y) noexcept;
351 // 25.8.5, class year // C++20
353 constexpr bool operator==(const year& x, const year& y) noexcept;
354 constexpr bool operator!=(const year& x, const year& y) noexcept;
355 constexpr bool operator< (const year& x, const year& y) noexcept;
356 constexpr bool operator> (const year& x, const year& y) noexcept;
357 constexpr bool operator<=(const year& x, const year& y) noexcept;
358 constexpr bool operator>=(const year& x, const year& y) noexcept;
359 constexpr year operator+(const year& x, const years& y) noexcept;
360 constexpr year operator+(const years& x, const year& y) noexcept;
361 constexpr year operator-(const year& x, const years& y) noexcept;
362 constexpr years operator-(const year& x, const year& y) noexcept;
364 // 25.8.6, class weekday // C++20
367 constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
368 constexpr bool operator!=(const weekday& x, const weekday& y) noexcept;
369 constexpr weekday operator+(const weekday& x, const days& y) noexcept;
370 constexpr weekday operator+(const days& x, const weekday& y) noexcept;
371 constexpr weekday operator-(const weekday& x, const days& y) noexcept;
372 constexpr days operator-(const weekday& x, const weekday& y) noexcept;
374 // 25.8.7, class weekday_indexed // C++20
376 class weekday_indexed;
377 constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
378 constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept;
380 // 25.8.8, class weekday_last // C++20
383 constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept;
384 constexpr bool operator!=(const weekday_last& x, const weekday_last& y) noexcept;
386 // 25.8.9, class month_day // C++20
389 constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
390 constexpr bool operator!=(const month_day& x, const month_day& y) noexcept;
391 constexpr bool operator< (const month_day& x, const month_day& y) noexcept;
392 constexpr bool operator> (const month_day& x, const month_day& y) noexcept;
393 constexpr bool operator<=(const month_day& x, const month_day& y) noexcept;
394 constexpr bool operator>=(const month_day& x, const month_day& y) noexcept;
397 // 25.8.10, class month_day_last // C++20
398 class month_day_last;
400 constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept;
401 constexpr bool operator!=(const month_day_last& x, const month_day_last& y) noexcept;
402 constexpr bool operator< (const month_day_last& x, const month_day_last& y) noexcept;
403 constexpr bool operator> (const month_day_last& x, const month_day_last& y) noexcept;
404 constexpr bool operator<=(const month_day_last& x, const month_day_last& y) noexcept;
405 constexpr bool operator>=(const month_day_last& x, const month_day_last& y) noexcept;
407 // 25.8.11, class month_weekday // C++20
410 constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept;
411 constexpr bool operator!=(const month_weekday& x, const month_weekday& y) noexcept;
413 // 25.8.12, class month_weekday_last // C++20
414 class month_weekday_last;
416 constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept;
417 constexpr bool operator!=(const month_weekday_last& x, const month_weekday_last& y) noexcept;
420 // 25.8.13, class year_month // C++20
423 constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
424 constexpr bool operator!=(const year_month& x, const year_month& y) noexcept;
425 constexpr bool operator< (const year_month& x, const year_month& y) noexcept;
426 constexpr bool operator> (const year_month& x, const year_month& y) noexcept;
427 constexpr bool operator<=(const year_month& x, const year_month& y) noexcept;
428 constexpr bool operator>=(const year_month& x, const year_month& y) noexcept;
430 constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
431 constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
432 constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
433 constexpr months operator-(const year_month& x, const year_month& y) noexcept;
434 constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
435 constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
436 constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
438 // 25.8.14, class year_month_day class // C++20
441 constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept;
442 constexpr bool operator!=(const year_month_day& x, const year_month_day& y) noexcept;
443 constexpr bool operator< (const year_month_day& x, const year_month_day& y) noexcept;
444 constexpr bool operator> (const year_month_day& x, const year_month_day& y) noexcept;
445 constexpr bool operator<=(const year_month_day& x, const year_month_day& y) noexcept;
446 constexpr bool operator>=(const year_month_day& x, const year_month_day& y) noexcept;
448 constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept;
449 constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept;
450 constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept;
451 constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept;
452 constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept;
453 constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept;
456 // 25.8.15, class year_month_day_last // C++20
457 class year_month_day_last;
459 constexpr bool operator==(const year_month_day_last& x,
460 const year_month_day_last& y) noexcept;
461 constexpr bool operator!=(const year_month_day_last& x,
462 const year_month_day_last& y) noexcept;
463 constexpr bool operator< (const year_month_day_last& x,
464 const year_month_day_last& y) noexcept;
465 constexpr bool operator> (const year_month_day_last& x,
466 const year_month_day_last& y) noexcept;
467 constexpr bool operator<=(const year_month_day_last& x,
468 const year_month_day_last& y) noexcept;
469 constexpr bool operator>=(const year_month_day_last& x,
470 const year_month_day_last& y) noexcept;
472 constexpr year_month_day_last
473 operator+(const year_month_day_last& ymdl, const months& dm) noexcept;
474 constexpr year_month_day_last
475 operator+(const months& dm, const year_month_day_last& ymdl) noexcept;
476 constexpr year_month_day_last
477 operator+(const year_month_day_last& ymdl, const years& dy) noexcept;
478 constexpr year_month_day_last
479 operator+(const years& dy, const year_month_day_last& ymdl) noexcept;
480 constexpr year_month_day_last
481 operator-(const year_month_day_last& ymdl, const months& dm) noexcept;
482 constexpr year_month_day_last
483 operator-(const year_month_day_last& ymdl, const years& dy) noexcept;
485 // 25.8.16, class year_month_weekday // C++20
486 class year_month_weekday;
488 constexpr bool operator==(const year_month_weekday& x,
489 const year_month_weekday& y) noexcept;
490 constexpr bool operator!=(const year_month_weekday& x,
491 const year_month_weekday& y) noexcept;
493 constexpr year_month_weekday
494 operator+(const year_month_weekday& ymwd, const months& dm) noexcept;
495 constexpr year_month_weekday
496 operator+(const months& dm, const year_month_weekday& ymwd) noexcept;
497 constexpr year_month_weekday
498 operator+(const year_month_weekday& ymwd, const years& dy) noexcept;
499 constexpr year_month_weekday
500 operator+(const years& dy, const year_month_weekday& ymwd) noexcept;
501 constexpr year_month_weekday
502 operator-(const year_month_weekday& ymwd, const months& dm) noexcept;
503 constexpr year_month_weekday
504 operator-(const year_month_weekday& ymwd, const years& dy) noexcept;
506 // 25.8.17, class year_month_weekday_last // C++20
507 class year_month_weekday_last;
509 constexpr bool operator==(const year_month_weekday_last& x,
510 const year_month_weekday_last& y) noexcept;
511 constexpr bool operator!=(const year_month_weekday_last& x,
512 const year_month_weekday_last& y) noexcept;
513 constexpr year_month_weekday_last
514 operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
515 constexpr year_month_weekday_last
516 operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept;
517 constexpr year_month_weekday_last
518 operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
519 constexpr year_month_weekday_last
520 operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept;
521 constexpr year_month_weekday_last
522 operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
523 constexpr year_month_weekday_last
524 operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
526 // 25.8.18, civil calendar conventional syntax operators // C++20
528 operator/(const year& y, const month& m) noexcept;
530 operator/(const year& y, int m) noexcept;
532 operator/(const month& m, const day& d) noexcept;
534 operator/(const month& m, int d) noexcept;
536 operator/(int m, const day& d) noexcept;
538 operator/(const day& d, const month& m) noexcept;
540 operator/(const day& d, int m) noexcept;
541 constexpr month_day_last
542 operator/(const month& m, last_spec) noexcept;
543 constexpr month_day_last
544 operator/(int m, last_spec) noexcept;
545 constexpr month_day_last
546 operator/(last_spec, const month& m) noexcept;
547 constexpr month_day_last
548 operator/(last_spec, int m) noexcept;
549 constexpr month_weekday
550 operator/(const month& m, const weekday_indexed& wdi) noexcept;
551 constexpr month_weekday
552 operator/(int m, const weekday_indexed& wdi) noexcept;
553 constexpr month_weekday
554 operator/(const weekday_indexed& wdi, const month& m) noexcept;
555 constexpr month_weekday
556 operator/(const weekday_indexed& wdi, int m) noexcept;
557 constexpr month_weekday_last
558 operator/(const month& m, const weekday_last& wdl) noexcept;
559 constexpr month_weekday_last
560 operator/(int m, const weekday_last& wdl) noexcept;
561 constexpr month_weekday_last
562 operator/(const weekday_last& wdl, const month& m) noexcept;
563 constexpr month_weekday_last
564 operator/(const weekday_last& wdl, int m) noexcept;
565 constexpr year_month_day
566 operator/(const year_month& ym, const day& d) noexcept;
567 constexpr year_month_day
568 operator/(const year_month& ym, int d) noexcept;
569 constexpr year_month_day
570 operator/(const year& y, const month_day& md) noexcept;
571 constexpr year_month_day
572 operator/(int y, const month_day& md) noexcept;
573 constexpr year_month_day
574 operator/(const month_day& md, const year& y) noexcept;
575 constexpr year_month_day
576 operator/(const month_day& md, int y) noexcept;
577 constexpr year_month_day_last
578 operator/(const year_month& ym, last_spec) noexcept;
579 constexpr year_month_day_last
580 operator/(const year& y, const month_day_last& mdl) noexcept;
581 constexpr year_month_day_last
582 operator/(int y, const month_day_last& mdl) noexcept;
583 constexpr year_month_day_last
584 operator/(const month_day_last& mdl, const year& y) noexcept;
585 constexpr year_month_day_last
586 operator/(const month_day_last& mdl, int y) noexcept;
587 constexpr year_month_weekday
588 operator/(const year_month& ym, const weekday_indexed& wdi) noexcept;
589 constexpr year_month_weekday
590 operator/(const year& y, const month_weekday& mwd) noexcept;
591 constexpr year_month_weekday
592 operator/(int y, const month_weekday& mwd) noexcept;
593 constexpr year_month_weekday
594 operator/(const month_weekday& mwd, const year& y) noexcept;
595 constexpr year_month_weekday
596 operator/(const month_weekday& mwd, int y) noexcept;
597 constexpr year_month_weekday_last
598 operator/(const year_month& ym, const weekday_last& wdl) noexcept;
599 constexpr year_month_weekday_last
600 operator/(const year& y, const month_weekday_last& mwdl) noexcept;
601 constexpr year_month_weekday_last
602 operator/(int y, const month_weekday_last& mwdl) noexcept;
603 constexpr year_month_weekday_last
604 operator/(const month_weekday_last& mwdl, const year& y) noexcept;
605 constexpr year_month_weekday_last
606 operator/(const month_weekday_last& mwdl, int y) noexcept;
608 // 26.9, class template hh_mm_ss
609 template <class Duration>
612 bool is_neg; // exposition only
613 chrono::hours h; // exposition only
614 chrono::minutes m; // exposition only
615 chrono::seconds s; // exposition only
616 precision ss; // exposition only
619 static unsigned constexpr fractional_width = see below;
620 using precision = see below;
622 constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {}
623 constexpr explicit hh_mm_ss(Duration d) noexcept;
625 constexpr bool is_negative() const noexcept;
626 constexpr chrono::hours hours() const noexcept;
627 constexpr chrono::minutes minutes() const noexcept;
628 constexpr chrono::seconds seconds() const noexcept;
629 constexpr precision subseconds() const noexcept;
631 constexpr explicit operator precision() const noexcept;
632 constexpr precision to_duration() const noexcept;
635 // 26.10, 12/24 hour functions
636 constexpr bool is_am(hours const& h) noexcept;
637 constexpr bool is_pm(hours const& h) noexcept;
638 constexpr hours make12(const hours& h) noexcept;
639 constexpr hours make24(const hours& h, bool is_pm) noexcept;
641 // 25.10.5, class time_zone // C++20
642 enum class choose {earliest, latest};
644 bool operator==(const time_zone& x, const time_zone& y) noexcept;
645 bool operator!=(const time_zone& x, const time_zone& y) noexcept;
646 bool operator<(const time_zone& x, const time_zone& y) noexcept;
647 bool operator>(const time_zone& x, const time_zone& y) noexcept;
648 bool operator<=(const time_zone& x, const time_zone& y) noexcept;
649 bool operator>=(const time_zone& x, const time_zone& y) noexcept;
651 // calendrical constants
652 inline constexpr last_spec last{}; // C++20
653 inline constexpr chrono::weekday Sunday{0}; // C++20
654 inline constexpr chrono::weekday Monday{1}; // C++20
655 inline constexpr chrono::weekday Tuesday{2}; // C++20
656 inline constexpr chrono::weekday Wednesday{3}; // C++20
657 inline constexpr chrono::weekday Thursday{4}; // C++20
658 inline constexpr chrono::weekday Friday{5}; // C++20
659 inline constexpr chrono::weekday Saturday{6}; // C++20
661 inline constexpr chrono::month January{1}; // C++20
662 inline constexpr chrono::month February{2}; // C++20
663 inline constexpr chrono::month March{3}; // C++20
664 inline constexpr chrono::month April{4}; // C++20
665 inline constexpr chrono::month May{5}; // C++20
666 inline constexpr chrono::month June{6}; // C++20
667 inline constexpr chrono::month July{7}; // C++20
668 inline constexpr chrono::month August{8}; // C++20
669 inline constexpr chrono::month September{9}; // C++20
670 inline constexpr chrono::month October{10}; // C++20
671 inline constexpr chrono::month November{11}; // C++20
672 inline constexpr chrono::month December{12}; // C++20
675 inline namespace literals {
676 inline namespace chrono_literals {
677 constexpr chrono::hours operator ""h(unsigned long long); // C++14
678 constexpr chrono::duration<unspecified , ratio<3600,1>> operator ""h(long double); // C++14
679 constexpr chrono::minutes operator ""min(unsigned long long); // C++14
680 constexpr chrono::duration<unspecified , ratio<60,1>> operator ""min(long double); // C++14
681 constexpr chrono::seconds operator ""s(unsigned long long); // C++14
682 constexpr chrono::duration<unspecified > operator ""s(long double); // C++14
683 constexpr chrono::milliseconds operator ""ms(unsigned long long); // C++14
684 constexpr chrono::duration<unspecified , milli> operator ""ms(long double); // C++14
685 constexpr chrono::microseconds operator ""us(unsigned long long); // C++14
686 constexpr chrono::duration<unspecified , micro> operator ""us(long double); // C++14
687 constexpr chrono::nanoseconds operator ""ns(unsigned long long); // C++14
688 constexpr chrono::duration<unspecified , nano> operator ""ns(long double); // C++14
689 constexpr chrono::day operator ""d(unsigned long long d) noexcept; // C++20
690 constexpr chrono::year operator ""y(unsigned long long y) noexcept; // C++20
697 #include <__chrono/calendar.h>
698 #include <__chrono/convert_to_timespec.h>
699 #include <__chrono/duration.h>
700 #include <__chrono/file_clock.h>
701 #include <__chrono/high_resolution_clock.h>
702 #include <__chrono/steady_clock.h>
703 #include <__chrono/system_clock.h>
704 #include <__chrono/time_point.h>
709 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
710 #pragma GCC system_header
713 #endif // _LIBCPP_CHRONO