Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
Louis Dionne | 9bd9388 | 2021-11-17 16:25:01 -0500 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 3 | // |
Chandler Carruth | d201210 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_CHRONO |
| 11 | #define _LIBCPP_CHRONO |
| 12 | |
| 13 | /* |
| 14 | chrono synopsis |
| 15 | |
| 16 | namespace std |
| 17 | { |
| 18 | namespace chrono |
| 19 | { |
| 20 | |
| 21 | template <class ToDuration, class Rep, class Period> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 22 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 23 | ToDuration |
| 24 | duration_cast(const duration<Rep, Period>& fd); |
| 25 | |
| 26 | template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {}; |
| 27 | |
Marshall Clow | f1bf62f | 2018-01-02 17:17:01 +0000 | [diff] [blame] | 28 | template <class Rep> inline constexpr bool treat_as_floating_point_v |
Marshall Clow | 59581f0 | 2015-11-30 05:39:30 +0000 | [diff] [blame] | 29 | = treat_as_floating_point<Rep>::value; // C++17 |
| 30 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 31 | template <class Rep> |
| 32 | struct duration_values |
| 33 | { |
| 34 | public: |
Marshall Clow | b1296bd | 2018-11-13 17:22:41 +0000 | [diff] [blame] | 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | // duration |
| 41 | |
| 42 | template <class Rep, class Period = ratio<1>> |
| 43 | class duration |
| 44 | { |
| 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"); |
| 48 | public: |
| 49 | typedef Rep rep; |
Marshall Clow | 76200b2 | 2017-03-21 18:38:57 +0000 | [diff] [blame] | 50 | typedef typename _Period::type period; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 51 | |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 52 | constexpr duration() = default; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 53 | template <class Rep2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 54 | constexpr explicit duration(const Rep2& r, |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 55 | typename enable_if |
| 56 | < |
| 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) |
| 60 | >::type* = 0); |
| 61 | |
| 62 | // conversions |
| 63 | template <class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 64 | constexpr duration(const duration<Rep2, Period2>& d, |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 65 | typename enable_if |
| 66 | < |
| 67 | treat_as_floating_point<rep>::value || |
| 68 | ratio_divide<Period2, period>::type::den == 1 |
| 69 | >::type* = 0); |
| 70 | |
| 71 | // observer |
| 72 | |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 73 | constexpr rep count() const; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 74 | |
| 75 | // arithmetic |
| 76 | |
Marshall Clow | 76200b2 | 2017-03-21 18:38:57 +0000 | [diff] [blame] | 77 | constexpr common_type<duration>::type operator+() const; |
| 78 | constexpr common_type<duration>::type operator-() const; |
Marshall Clow | df247eb | 2018-08-29 23:02:15 +0000 | [diff] [blame] | 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 83 | |
Marshall Clow | df247eb | 2018-08-29 23:02:15 +0000 | [diff] [blame] | 84 | constexpr duration& operator+=(const duration& d); // constexpr in C++17 |
| 85 | constexpr duration& operator-=(const duration& d); // constexpr in C++17 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 86 | |
Marshall Clow | df247eb | 2018-08-29 23:02:15 +0000 | [diff] [blame] | 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 91 | |
| 92 | // special values |
| 93 | |
Marshall Clow | b1296bd | 2018-11-13 17:22:41 +0000 | [diff] [blame] | 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 97 | }; |
| 98 | |
| 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; |
| 105 | |
| 106 | template <class Clock, class Duration = typename Clock::duration> |
| 107 | class time_point |
| 108 | { |
| 109 | public: |
| 110 | typedef Clock clock; |
| 111 | typedef Duration duration; |
| 112 | typedef typename duration::rep rep; |
| 113 | typedef typename duration::period period; |
| 114 | private: |
| 115 | duration d_; // exposition only |
| 116 | |
| 117 | public: |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 120 | |
| 121 | // conversions |
| 122 | template <class Duration2> |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 123 | time_point(const time_point<clock, Duration2>& t); // constexpr in C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 124 | |
| 125 | // observer |
| 126 | |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 127 | duration time_since_epoch() const; // constexpr in C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 128 | |
| 129 | // arithmetic |
| 130 | |
Marshall Clow | df247eb | 2018-08-29 23:02:15 +0000 | [diff] [blame] | 131 | time_point& operator+=(const duration& d); // constexpr in C++17 |
| 132 | time_point& operator-=(const duration& d); // constexpr in C++17 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 133 | |
| 134 | // special values |
| 135 | |
Marshall Clow | b1296bd | 2018-11-13 17:22:41 +0000 | [diff] [blame] | 136 | static constexpr time_point min(); // noexcept in C++20 |
| 137 | static constexpr time_point max(); // noexcept in C++20 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | } // chrono |
| 141 | |
| 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>>; |
| 145 | |
| 146 | template <class Clock, class Duration1, class Duration2> |
| 147 | struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>; |
| 148 | |
| 149 | namespace chrono { |
| 150 | |
| 151 | // duration arithmetic |
| 152 | template <class Rep1, class Period1, class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 153 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 157 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 161 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 165 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 169 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 173 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 174 | typename common_type<Rep1, Rep2>::type |
| 175 | operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 176 | |
| 177 | // duration comparisons |
| 178 | template <class Rep1, class Period1, class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 179 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 180 | bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 181 | template <class Rep1, class Period1, class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 182 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 183 | bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 184 | template <class Rep1, class Period1, class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 185 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 186 | bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 187 | template <class Rep1, class Period1, class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 188 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 189 | bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 190 | template <class Rep1, class Period1, class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 191 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 192 | bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 193 | template <class Rep1, class Period1, class Rep2, class Period2> |
Howard Hinnant | cf3143c | 2012-07-13 19:17:27 +0000 | [diff] [blame] | 194 | constexpr |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 195 | bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 196 | |
| 197 | // duration_cast |
| 198 | template <class ToDuration, class Rep, class Period> |
| 199 | ToDuration duration_cast(const duration<Rep, Period>& d); |
| 200 | |
Marshall Clow | f2eabaf | 2015-11-05 19:33:59 +0000 | [diff] [blame] | 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 |
| 207 | |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 208 | // duration I/O is elsewhere |
| 209 | |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 210 | // time_point arithmetic (all constexpr in C++14) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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); |
| 223 | |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 224 | // time_point comparisons (all constexpr in C++14) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 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); |
| 237 | |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 238 | // time_point_cast (constexpr in C++14) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 239 | |
| 240 | template <class ToDuration, class Clock, class Duration> |
| 241 | time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t); |
| 242 | |
Marshall Clow | f2eabaf | 2015-11-05 19:33:59 +0000 | [diff] [blame] | 243 | template <class ToDuration, class Clock, class Duration> |
| 244 | constexpr time_point<Clock, ToDuration> |
| 245 | floor(const time_point<Clock, Duration>& tp); // C++17 |
| 246 | |
| 247 | template <class ToDuration, class Clock, class Duration> |
| 248 | constexpr time_point<Clock, ToDuration> |
| 249 | ceil(const time_point<Clock, Duration>& tp); // C++17 |
| 250 | |
| 251 | template <class ToDuration, class Clock, class Duration> |
| 252 | constexpr time_point<Clock, ToDuration> |
| 253 | round(const time_point<Clock, Duration>& tp); // C++17 |
| 254 | |
| 255 | template <class Rep, class Period> |
| 256 | constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17 |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 257 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 258 | // Clocks |
| 259 | |
| 260 | class system_clock |
| 261 | { |
| 262 | public: |
| 263 | typedef microseconds duration; |
| 264 | typedef duration::rep rep; |
| 265 | typedef duration::period period; |
| 266 | typedef chrono::time_point<system_clock> time_point; |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 267 | static const bool is_steady = false; // constexpr in C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 268 | |
Howard Hinnant | aa54ac4 | 2011-05-28 18:34:36 +0000 | [diff] [blame] | 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; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 272 | }; |
| 273 | |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 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 |
| 278 | |
Louis Dionne | b35fab8 | 2021-11-08 15:30:32 -0500 | [diff] [blame] | 279 | class file_clock // C++20 |
| 280 | { |
| 281 | public: |
| 282 | typedef see-below rep; |
| 283 | typedef nano period; |
| 284 | typedef chrono::duration<rep, period> duration; |
| 285 | typedef chrono::time_point<file_clock> time_point; |
| 286 | static constexpr bool is_steady = false; |
| 287 | |
| 288 | static time_point now() noexcept; |
| 289 | |
| 290 | template<class Duration> |
| 291 | static sys_time<see-below> to_sys(const file_time<Duration>&); |
| 292 | |
| 293 | template<class Duration> |
| 294 | static file_time<see-below> from_sys(const sys_time<Duration>&); |
| 295 | }; |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 296 | |
| 297 | template<class Duration> |
| 298 | using file_time = time_point<file_clock, Duration>; // C++20 |
| 299 | |
Howard Hinnant | c8dbd22 | 2010-11-20 19:16:30 +0000 | [diff] [blame] | 300 | class steady_clock |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 301 | { |
| 302 | public: |
| 303 | typedef nanoseconds duration; |
| 304 | typedef duration::rep rep; |
| 305 | typedef duration::period period; |
Howard Hinnant | c8dbd22 | 2010-11-20 19:16:30 +0000 | [diff] [blame] | 306 | typedef chrono::time_point<steady_clock, duration> time_point; |
Marshall Clow | 5c459c9 | 2013-07-31 19:32:19 +0000 | [diff] [blame] | 307 | static const bool is_steady = true; // constexpr in C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 308 | |
Howard Hinnant | aa54ac4 | 2011-05-28 18:34:36 +0000 | [diff] [blame] | 309 | static time_point now() noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 310 | }; |
| 311 | |
Howard Hinnant | c8dbd22 | 2010-11-20 19:16:30 +0000 | [diff] [blame] | 312 | typedef steady_clock high_resolution_clock; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 313 | |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 314 | // 25.7.8, local time // C++20 |
| 315 | struct local_t {}; |
| 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>; |
| 320 | |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 321 | // 25.8.2, class last_spec // C++20 |
| 322 | struct last_spec; |
| 323 | |
| 324 | // 25.8.3, class day // C++20 |
| 325 | |
| 326 | class day; |
| 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; |
| 337 | |
| 338 | // 25.8.4, class month // C++20 |
| 339 | class month; |
| 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; |
| 350 | |
| 351 | // 25.8.5, class year // C++20 |
| 352 | class year; |
| 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; |
| 363 | |
| 364 | // 25.8.6, class weekday // C++20 |
| 365 | class weekday; |
| 366 | |
| 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; |
| 373 | |
| 374 | // 25.8.7, class weekday_indexed // C++20 |
| 375 | |
| 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; |
| 379 | |
| 380 | // 25.8.8, class weekday_last // C++20 |
| 381 | class weekday_last; |
| 382 | |
| 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; |
| 385 | |
| 386 | // 25.8.9, class month_day // C++20 |
| 387 | class month_day; |
| 388 | |
| 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; |
| 395 | |
| 396 | |
| 397 | // 25.8.10, class month_day_last // C++20 |
| 398 | class month_day_last; |
| 399 | |
| 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; |
| 406 | |
| 407 | // 25.8.11, class month_weekday // C++20 |
| 408 | class month_weekday; |
| 409 | |
| 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; |
| 412 | |
| 413 | // 25.8.12, class month_weekday_last // C++20 |
| 414 | class month_weekday_last; |
| 415 | |
| 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; |
| 418 | |
| 419 | |
| 420 | // 25.8.13, class year_month // C++20 |
| 421 | class year_month; |
| 422 | |
| 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; |
| 429 | |
| 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; |
| 437 | |
| 438 | // 25.8.14, class year_month_day class // C++20 |
| 439 | year_month_day; |
| 440 | |
| 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; |
| 447 | |
| 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; |
| 454 | |
| 455 | |
| 456 | // 25.8.15, class year_month_day_last // C++20 |
| 457 | class year_month_day_last; |
| 458 | |
| 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; |
| 471 | |
| 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; |
| 484 | |
| 485 | // 25.8.16, class year_month_weekday // C++20 |
| 486 | class year_month_weekday; |
| 487 | |
| 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; |
| 492 | |
| 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; |
| 505 | |
| 506 | // 25.8.17, class year_month_weekday_last // C++20 |
| 507 | class year_month_weekday_last; |
| 508 | |
| 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; |
Louis Dionne | 44bcff9 | 2018-08-03 22:36:53 +0000 | [diff] [blame] | 525 | |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 526 | // 25.8.18, civil calendar conventional syntax operators // C++20 |
| 527 | constexpr year_month |
| 528 | operator/(const year& y, const month& m) noexcept; |
| 529 | constexpr year_month |
| 530 | operator/(const year& y, int m) noexcept; |
| 531 | constexpr month_day |
| 532 | operator/(const month& m, const day& d) noexcept; |
| 533 | constexpr month_day |
| 534 | operator/(const month& m, int d) noexcept; |
| 535 | constexpr month_day |
| 536 | operator/(int m, const day& d) noexcept; |
| 537 | constexpr month_day |
| 538 | operator/(const day& d, const month& m) noexcept; |
| 539 | constexpr month_day |
| 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 |
Louis Dionne | 44bcff9 | 2018-08-03 22:36:53 +0000 | [diff] [blame] | 606 | operator/(const month_weekday_last& mwdl, int y) noexcept; |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 607 | |
Marshall Clow | 748d1a6 | 2019-08-08 14:36:07 +0000 | [diff] [blame] | 608 | // 26.9, class template hh_mm_ss |
| 609 | template <class Duration> |
| 610 | class hh_mm_ss |
| 611 | { |
| 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 |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 617 | |
Marshall Clow | 748d1a6 | 2019-08-08 14:36:07 +0000 | [diff] [blame] | 618 | public: |
| 619 | static unsigned constexpr fractional_width = see below; |
| 620 | using precision = see below; |
| 621 | |
| 622 | constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {} |
| 623 | constexpr explicit hh_mm_ss(Duration d) noexcept; |
| 624 | |
| 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; |
| 630 | |
| 631 | constexpr explicit operator precision() const noexcept; |
| 632 | constexpr precision to_duration() const noexcept; |
| 633 | }; |
| 634 | |
Marshall Clow | 748d1a6 | 2019-08-08 14:36:07 +0000 | [diff] [blame] | 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; |
| 640 | |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 641 | // 25.10.5, class time_zone // C++20 |
| 642 | enum class choose {earliest, latest}; |
| 643 | class time_zone; |
| 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; |
Louis Dionne | 44bcff9 | 2018-08-03 22:36:53 +0000 | [diff] [blame] | 650 | |
Marshall Clow | 2605835 | 2018-10-16 17:27:54 +0000 | [diff] [blame] | 651 | // calendrical constants |
Louis Dionne | 44bcff9 | 2018-08-03 22:36:53 +0000 | [diff] [blame] | 652 | inline constexpr last_spec last{}; // C++20 |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 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 |
| 660 | |
| 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 673 | } // chrono |
| 674 | |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 675 | inline namespace literals { |
| 676 | inline namespace chrono_literals { |
Marshall Clow | 2ac805a | 2017-08-09 15:42:50 +0000 | [diff] [blame] | 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 |
Marshall Clow | 40ca0c1 | 2018-07-18 17:37:51 +0000 | [diff] [blame] | 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 |
| 691 | } // chrono_literals |
| 692 | } // literals |
Marshall Clow | eb41e5c | 2013-07-24 21:18:14 +0000 | [diff] [blame] | 693 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 694 | } // std |
| 695 | */ |
| 696 | |
Louis Dionne | 9c2a3205 | 2022-01-10 14:56:43 -0500 | [diff] [blame] | 697 | #include <__chrono/calendar.h> |
Louis Dionne | caf2683 | 2022-01-10 09:43:29 -0500 | [diff] [blame] | 698 | #include <__chrono/convert_to_timespec.h> |
Louis Dionne | 9c2a3205 | 2022-01-10 14:56:43 -0500 | [diff] [blame] | 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> |
Arthur O'Dwyer | ef18160 | 2021-05-19 11:57:04 -0400 | [diff] [blame] | 705 | #include <__config> |
Arthur O'Dwyer | 7deec12 | 2021-03-24 18:19:12 -0400 | [diff] [blame] | 706 | #include <compare> |
Marshall Clow | 0a1e750 | 2018-09-12 19:41:40 +0000 | [diff] [blame] | 707 | #include <version> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 708 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 709 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Arthur O'Dwyer | 6eeaa00 | 2022-02-01 20:16:40 -0500 | [diff] [blame] | 710 | # pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 711 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 712 | |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 713 | #endif // _LIBCPP_CHRONO |