| 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 |
| 11 | #define _LIBCPP_CHRONO |
| 12 | |
| 13 | // clang-format off |
| 14 | |
| 15 | /* |
| 16 | chrono synopsis |
| 17 | |
| 18 | #include <compare> // C++20 |
| 19 | |
| 20 | namespace std |
| 21 | { |
| 22 | namespace chrono |
| 23 | { |
| 24 | |
| 25 | template <class ToDuration, class Rep, class Period> |
| 26 | constexpr |
| 27 | ToDuration |
| 28 | duration_cast(const duration<Rep, Period>& fd); |
| 29 | |
| 30 | template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {}; |
| 31 | |
| 32 | template <class Rep> inline constexpr bool treat_as_floating_point_v |
| 33 | = treat_as_floating_point<Rep>::value; // C++17 |
| 34 | |
| 35 | template <class Rep> |
| 36 | struct duration_values |
| 37 | { |
| 38 | public: |
| 39 | static constexpr Rep zero(); // noexcept in C++20 |
| 40 | static constexpr Rep max(); // noexcept in C++20 |
| 41 | static constexpr Rep min(); // noexcept in C++20 |
| 42 | }; |
| 43 | |
| 44 | // duration |
| 45 | |
| 46 | template <class Rep, class Period = ratio<1>> |
| 47 | class duration |
| 48 | { |
| 49 | static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration"); |
| 50 | static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio"); |
| 51 | static_assert(Period::num > 0, "duration period must be positive"); |
| 52 | public: |
| 53 | typedef Rep rep; |
| 54 | typedef typename _Period::type period; |
| 55 | |
| 56 | constexpr duration() = default; |
| 57 | template <class Rep2> |
| 58 | constexpr explicit duration(const Rep2& r, |
| 59 | typename enable_if |
| 60 | < |
| 61 | is_convertible<const Rep2&, rep>::value && |
| 62 | (treat_as_floating_point<rep>::value || |
| 63 | !treat_as_floating_point<rep>::value && !treat_as_floating_point<Rep2>::value) |
| 64 | >::type* = 0); |
| 65 | |
| 66 | // conversions |
| 67 | template <class Rep2, class Period2> |
| 68 | constexpr duration(const duration<Rep2, Period2>& d, |
| 69 | typename enable_if |
| 70 | < |
| 71 | treat_as_floating_point<rep>::value || |
| 72 | ratio_divide<Period2, period>::type::den == 1 |
| 73 | >::type* = 0); |
| 74 | |
| 75 | // observer |
| 76 | |
| 77 | constexpr rep count() const; |
| 78 | |
| 79 | // arithmetic |
| 80 | |
| 81 | constexpr common_type<duration>::type operator+() const; |
| 82 | constexpr common_type<duration>::type operator-() const; |
| 83 | constexpr duration& operator++(); // constexpr in C++17 |
| 84 | constexpr duration operator++(int); // constexpr in C++17 |
| 85 | constexpr duration& operator--(); // constexpr in C++17 |
| 86 | constexpr duration operator--(int); // constexpr in C++17 |
| 87 | |
| 88 | constexpr duration& operator+=(const duration& d); // constexpr in C++17 |
| 89 | constexpr duration& operator-=(const duration& d); // constexpr in C++17 |
| 90 | |
| 91 | duration& operator*=(const rep& rhs); // constexpr in C++17 |
| 92 | duration& operator/=(const rep& rhs); // constexpr in C++17 |
| 93 | duration& operator%=(const rep& rhs); // constexpr in C++17 |
| 94 | duration& operator%=(const duration& rhs); // constexpr in C++17 |
| 95 | |
| 96 | // special values |
| 97 | |
| 98 | static constexpr duration zero(); // noexcept in C++20 |
| 99 | static constexpr duration min(); // noexcept in C++20 |
| 100 | static constexpr duration max(); // noexcept in C++20 |
| 101 | }; |
| 102 | |
| 103 | typedef duration<long long, nano> nanoseconds; |
| 104 | typedef duration<long long, micro> microseconds; |
| 105 | typedef duration<long long, milli> milliseconds; |
| 106 | typedef duration<long long > seconds; |
| 107 | typedef duration< long, ratio< 60> > minutes; |
| 108 | typedef duration< long, ratio<3600> > hours; |
| 109 | |
| 110 | template <class Clock, class Duration = typename Clock::duration> |
| 111 | class time_point |
| 112 | { |
| 113 | public: |
| 114 | typedef Clock clock; |
| 115 | typedef Duration duration; |
| 116 | typedef typename duration::rep rep; |
| 117 | typedef typename duration::period period; |
| 118 | private: |
| 119 | duration d_; // exposition only |
| 120 | |
| 121 | public: |
| 122 | time_point(); // has value "epoch" // constexpr in C++14 |
| 123 | explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14 |
| 124 | |
| 125 | // conversions |
| 126 | template <class Duration2> |
| 127 | time_point(const time_point<clock, Duration2>& t); // constexpr in C++14 |
| 128 | |
| 129 | // observer |
| 130 | |
| 131 | duration time_since_epoch() const; // constexpr in C++14 |
| 132 | |
| 133 | // arithmetic |
| 134 | |
| 135 | constexpr time_point& operator++(); // C++20 |
| 136 | constexpr time_point operator++(int); // C++20 |
| 137 | constexpr time_point& operator--(); // C++20 |
| 138 | constexpr time_point operator--(int); // C++20 |
| 139 | |
| 140 | time_point& operator+=(const duration& d); // constexpr in C++17 |
| 141 | time_point& operator-=(const duration& d); // constexpr in C++17 |
| 142 | |
| 143 | // special values |
| 144 | |
| 145 | static constexpr time_point min(); // noexcept in C++20 |
| 146 | static constexpr time_point max(); // noexcept in C++20 |
| 147 | }; |
| 148 | |
| 149 | } // chrono |
| 150 | |
| 151 | // common_type traits |
| 152 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 153 | struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>; |
| 154 | |
| 155 | template <class Clock, class Duration1, class Duration2> |
| 156 | struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>; |
| 157 | |
| 158 | namespace chrono { |
| 159 | |
| 160 | // duration arithmetic |
| 161 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 162 | constexpr |
| 163 | typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type |
| 164 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 165 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 166 | constexpr |
| 167 | typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type |
| 168 | operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 169 | template <class Rep1, class Period, class Rep2> |
| 170 | constexpr |
| 171 | duration<typename common_type<Rep1, Rep2>::type, Period> |
| 172 | operator*(const duration<Rep1, Period>& d, const Rep2& s); |
| 173 | template <class Rep1, class Period, class Rep2> |
| 174 | constexpr |
| 175 | duration<typename common_type<Rep1, Rep2>::type, Period> |
| 176 | operator*(const Rep1& s, const duration<Rep2, Period>& d); |
| 177 | template <class Rep1, class Period, class Rep2> |
| 178 | constexpr |
| 179 | duration<typename common_type<Rep1, Rep2>::type, Period> |
| 180 | operator/(const duration<Rep1, Period>& d, const Rep2& s); |
| 181 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 182 | constexpr |
| 183 | typename common_type<Rep1, Rep2>::type |
| 184 | operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 185 | |
| 186 | // duration comparisons |
| 187 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 188 | constexpr |
| 189 | bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 190 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 191 | constexpr |
| 192 | bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); // removed in C++20 |
| 193 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 194 | constexpr |
| 195 | bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 196 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 197 | constexpr |
| 198 | bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 199 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 200 | constexpr |
| 201 | bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 202 | template <class Rep1, class Period1, class Rep2, class Period2> |
| 203 | constexpr |
| 204 | bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); |
| 205 | template<class Rep1, class Period1, class Rep2, class Period2> |
| 206 | requires three_way_comparable<typename CT::rep> |
| 207 | constexpr auto operator<=>(const duration<Rep1, Period1>& lhs, |
| 208 | const duration<Rep2, Period2>& rhs); // since C++20 |
| 209 | |
| 210 | // duration_cast |
| 211 | template <class ToDuration, class Rep, class Period> |
| 212 | ToDuration duration_cast(const duration<Rep, Period>& d); |
| 213 | |
| 214 | template <class ToDuration, class Rep, class Period> |
| 215 | constexpr ToDuration floor(const duration<Rep, Period>& d); // C++17 |
| 216 | template <class ToDuration, class Rep, class Period> |
| 217 | constexpr ToDuration ceil(const duration<Rep, Period>& d); // C++17 |
| 218 | template <class ToDuration, class Rep, class Period> |
| 219 | constexpr ToDuration round(const duration<Rep, Period>& d); // C++17 |
| 220 | |
| 221 | // duration I/O |
| 222 | template<class charT, class traits, class Rep, class Period> // C++20 |
| 223 | basic_ostream<charT, traits>& |
| 224 | operator<<(basic_ostream<charT, traits>& os, |
| 225 | const duration<Rep, Period>& d); |
| 226 | |
| 227 | // time_point arithmetic (all constexpr in C++14) |
| 228 | template <class Clock, class Duration1, class Rep2, class Period2> |
| 229 | time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type> |
| 230 | operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs); |
| 231 | template <class Rep1, class Period1, class Clock, class Duration2> |
| 232 | time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type> |
| 233 | operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs); |
| 234 | template <class Clock, class Duration1, class Rep2, class Period2> |
| 235 | time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type> |
| 236 | operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs); |
| 237 | template <class Clock, class Duration1, class Duration2> |
| 238 | typename common_type<Duration1, Duration2>::type |
| 239 | operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); |
| 240 | |
| 241 | // time_point comparisons (all constexpr in C++14) |
| 242 | template <class Clock, class Duration1, class Duration2> |
| 243 | bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); |
| 244 | template <class Clock, class Duration1, class Duration2> |
| 245 | bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); // removed in C++20 |
| 246 | template <class Clock, class Duration1, class Duration2> |
| 247 | bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); |
| 248 | template <class Clock, class Duration1, class Duration2> |
| 249 | bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); |
| 250 | template <class Clock, class Duration1, class Duration2> |
| 251 | bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); |
| 252 | template <class Clock, class Duration1, class Duration2> |
| 253 | bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); |
| 254 | template<class Clock, class Duration1, |
| 255 | three_way_comparable_with<Duration1> Duration2> |
| 256 | constexpr auto operator<=>(const time_point<Clock, Duration1>& lhs, |
| 257 | const time_point<Clock, Duration2>& rhs); // since C++20 |
| 258 | |
| 259 | // time_point_cast (constexpr in C++14) |
| 260 | |
| 261 | template <class ToDuration, class Clock, class Duration> |
| 262 | time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t); |
| 263 | |
| 264 | template <class ToDuration, class Clock, class Duration> |
| 265 | constexpr time_point<Clock, ToDuration> |
| 266 | floor(const time_point<Clock, Duration>& tp); // C++17 |
| 267 | |
| 268 | template <class ToDuration, class Clock, class Duration> |
| 269 | constexpr time_point<Clock, ToDuration> |
| 270 | ceil(const time_point<Clock, Duration>& tp); // C++17 |
| 271 | |
| 272 | template <class ToDuration, class Clock, class Duration> |
| 273 | constexpr time_point<Clock, ToDuration> |
| 274 | round(const time_point<Clock, Duration>& tp); // C++17 |
| 275 | |
| 276 | template <class Rep, class Period> |
| 277 | constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17 |
| 278 | |
| 279 | // Clocks |
| 280 | |
| 281 | class system_clock |
| 282 | { |
| 283 | public: |
| 284 | typedef microseconds duration; |
| 285 | typedef duration::rep rep; |
| 286 | typedef duration::period period; |
| 287 | typedef chrono::time_point<system_clock> time_point; |
| 288 | static const bool is_steady = false; // constexpr in C++14 |
| 289 | |
| 290 | static time_point now() noexcept; |
| 291 | static time_t to_time_t (const time_point& __t) noexcept; |
| 292 | static time_point from_time_t(time_t __t) noexcept; |
| 293 | }; |
| 294 | |
| 295 | template <class Duration> |
| 296 | using sys_time = time_point<system_clock, Duration>; // C++20 |
| 297 | using sys_seconds = sys_time<seconds>; // C++20 |
| 298 | using sys_days = sys_time<days>; // C++20 |
| 299 | |
| 300 | template<class charT, class traits, class Duration> // C++20 |
| 301 | basic_ostream<charT, traits>& |
| 302 | operator<<(basic_ostream<charT, traits>& os, const sys_time<Duration>& tp); |
| 303 | |
| 304 | template<class charT, class traits> // C++20 |
| 305 | basic_ostream<charT, traits>& |
| 306 | operator<<(basic_ostream<charT, traits>& os, const sys_days& dp); |
| 307 | |
| 308 | // [time.clock.utc], class utc_clock |
| 309 | class utc_clock { // C++20 |
| 310 | public: |
| 311 | using rep = a signed arithmetic type; |
| 312 | using period = ratio<unspecified, unspecified>; |
| 313 | using duration = chrono::duration<rep, period>; |
| 314 | using time_point = chrono::time_point<utc_clock>; |
| 315 | static constexpr bool is_steady = unspecified; |
| 316 | |
| 317 | static time_point now(); |
| 318 | |
| 319 | template<class Duration> |
| 320 | static sys_time<common_type_t<Duration, seconds>> |
| 321 | to_sys(const utc_time<Duration>& t); |
| 322 | template<class Duration> |
| 323 | static utc_time<common_type_t<Duration, seconds>> |
| 324 | from_sys(const sys_time<Duration>& t); |
| 325 | }; |
| 326 | |
| 327 | template<class Duration> |
| 328 | using utc_time = time_point<utc_clock, Duration>; // C++20 |
| 329 | using utc_seconds = utc_time<seconds>; // C++20 |
| 330 | |
| 331 | template<class charT, class traits, class Duration> // C++20 |
| 332 | basic_ostream<charT, traits>& |
| 333 | operator<<(basic_ostream<charT, traits>& os, const utc_time<Duration>& t); |
| 334 | |
| 335 | struct leap_second_info { // C++20 |
| 336 | bool is_leap_second; |
| 337 | seconds elapsed; |
| 338 | }; |
| 339 | |
| 340 | template<class Duration> // C++20 |
| 341 | leap_second_info get_leap_second_info(const utc_time<Duration>& ut); |
| 342 | |
| 343 | |
| 344 | // [time.clock.tai], class tai_clock |
| 345 | class tai_clock { // C++20 |
| 346 | public: |
| 347 | using rep = a signed arithmetic type; |
| 348 | using period = ratio<unspecified, unspecified>; |
| 349 | using duration = chrono::duration<rep, period>; |
| 350 | using time_point = chrono::time_point<tai_clock>; |
| 351 | static constexpr bool is_steady = unspecified; |
| 352 | |
| 353 | static time_point now(); |
| 354 | |
| 355 | template<class Duration> |
| 356 | static utc_time<common_type_t<Duration, seconds>> |
| 357 | to_utc(const tai_time<Duration>& t); |
| 358 | template<class Duration> |
| 359 | static tai_time<common_type_t<Duration, seconds>> |
| 360 | from_utc(const utc_time<Duration>& t); |
| 361 | }; |
| 362 | |
| 363 | template<class Duration> |
| 364 | using tai_time = time_point<tai_clock, Duration>; // C++20 |
| 365 | using tai_seconds = tai_time<seconds>; // C++20 |
| 366 | |
| 367 | template<class charT, class traits, class Duration> // C++20 |
| 368 | basic_ostream<charT, traits>& |
| 369 | operator<<(basic_ostream<charT, traits>& os, const tai_time<Duration>& t); |
| 370 | |
| 371 | // [time.clock.gps], class gps_clock |
| 372 | class gps_clock { // C++20 |
| 373 | public: |
| 374 | using rep = a signed arithmetic type; |
| 375 | using period = ratio<unspecified, unspecified>; |
| 376 | using duration = chrono::duration<rep, period>; |
| 377 | using time_point = chrono::time_point<gps_clock>; |
| 378 | static constexpr bool is_steady = unspecified; |
| 379 | |
| 380 | static time_point now(); |
| 381 | |
| 382 | template<class Duration> |
| 383 | static utc_time<common_type_t<Duration, seconds>> |
| 384 | to_utc(const gps_time<Duration>& t); |
| 385 | template<class Duration> |
| 386 | static gps_time<common_type_t<Duration, seconds>> |
| 387 | from_utc(const utc_time<Duration>& t); |
| 388 | }; |
| 389 | |
| 390 | template<class Duration> |
| 391 | using gps_time = time_point<gps_clock, Duration>; // C++20 |
| 392 | using gps_seconds = gps_time<seconds>; // C++20 |
| 393 | |
| 394 | template<class charT, class traits, class Duration> // C++20 |
| 395 | basic_ostream<charT, traits>& |
| 396 | operator<<(basic_ostream<charT, traits>& os, const gps_time<Duration>& t); |
| 397 | |
| 398 | class file_clock // C++20 |
| 399 | { |
| 400 | public: |
| 401 | typedef see-below rep; |
| 402 | typedef nano period; |
| 403 | typedef chrono::duration<rep, period> duration; |
| 404 | typedef chrono::time_point<file_clock> time_point; |
| 405 | static constexpr bool is_steady = false; |
| 406 | |
| 407 | static time_point now() noexcept; |
| 408 | |
| 409 | template<class Duration> |
| 410 | static sys_time<see-below> to_sys(const file_time<Duration>&); |
| 411 | |
| 412 | template<class Duration> |
| 413 | static file_time<see-below> from_sys(const sys_time<Duration>&); |
| 414 | }; |
| 415 | |
| 416 | template<class Duration> |
| 417 | using file_time = time_point<file_clock, Duration>; // C++20 |
| 418 | |
| 419 | template<class charT, class traits, class Duration> // C++20 |
| 420 | basic_ostream<charT, traits>& |
| 421 | operator<<(basic_ostream<charT, traits>& os, const file_time<Duration>& tp); |
| 422 | |
| 423 | class steady_clock |
| 424 | { |
| 425 | public: |
| 426 | typedef nanoseconds duration; |
| 427 | typedef duration::rep rep; |
| 428 | typedef duration::period period; |
| 429 | typedef chrono::time_point<steady_clock, duration> time_point; |
| 430 | static const bool is_steady = true; // constexpr in C++14 |
| 431 | |
| 432 | static time_point now() noexcept; |
| 433 | }; |
| 434 | |
| 435 | typedef steady_clock high_resolution_clock; |
| 436 | |
| 437 | // [time.clock.local] local time // C++20 |
| 438 | struct local_t {}; |
| 439 | template<class Duration> |
| 440 | using local_time = time_point<local_t, Duration>; |
| 441 | using local_seconds = local_time<seconds>; |
| 442 | using local_days = local_time<days>; |
| 443 | |
| 444 | template<class charT, class traits, class Duration> // C++20 |
| 445 | basic_ostream<charT, traits>& |
| 446 | operator<<(basic_ostream<charT, traits>& os, const local_time<Duration>& tp); |
| 447 | |
| 448 | // [time.cal.last] class last_spec // C++20 |
| 449 | struct last_spec; |
| 450 | |
| 451 | // [time.cal.day] class day // C++20 |
| 452 | |
| 453 | class day; |
| 454 | constexpr bool operator==(const day& x, const day& y) noexcept; |
| 455 | constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept; |
| 456 | constexpr day operator+(const day& x, const days& y) noexcept; |
| 457 | constexpr day operator+(const days& x, const day& y) noexcept; |
| 458 | constexpr day operator-(const day& x, const days& y) noexcept; |
| 459 | constexpr days operator-(const day& x, const day& y) noexcept; |
| 460 | template<class charT, class traits> |
| 461 | basic_ostream<charT, traits>& |
| 462 | operator<<(basic_ostream<charT, traits>& os, const day& d); |
| 463 | |
| 464 | // [time.cal.month] class month // C++20 |
| 465 | class month; |
| 466 | constexpr bool operator==(const month& x, const month& y) noexcept; |
| 467 | constexpr strong_ordering operator<=>(const month& x, const month& y) noexcept; |
| 468 | |
| 469 | constexpr month operator+(const month& x, const months& y) noexcept; |
| 470 | constexpr month operator+(const months& x, const month& y) noexcept; |
| 471 | constexpr month operator-(const month& x, const months& y) noexcept; |
| 472 | constexpr months operator-(const month& x, const month& y) noexcept; |
| 473 | template<class charT, class traits> |
| 474 | basic_ostream<charT, traits>& |
| 475 | operator<<(basic_ostream<charT, traits>& os, const month& m); |
| 476 | |
| 477 | // [time.cal.year] class year // C++20 |
| 478 | class year; |
| 479 | constexpr bool operator==(const year& x, const year& y) noexcept; |
| 480 | constexpr strong_ordering operator<=>(const year& x, const year& y) noexcept; |
| 481 | |
| 482 | constexpr year operator+(const year& x, const years& y) noexcept; |
| 483 | constexpr year operator+(const years& x, const year& y) noexcept; |
| 484 | constexpr year operator-(const year& x, const years& y) noexcept; |
| 485 | constexpr years operator-(const year& x, const year& y) noexcept; |
| 486 | template<class charT, class traits> |
| 487 | basic_ostream<charT, traits>& |
| 488 | operator<<(basic_ostream<charT, traits>& os, const year& y); |
| 489 | |
| 490 | // [time.cal.wd] class weekday // C++20 |
| 491 | class weekday; |
| 492 | |
| 493 | constexpr bool operator==(const weekday& x, const weekday& y) noexcept; |
| 494 | constexpr weekday operator+(const weekday& x, const days& y) noexcept; |
| 495 | constexpr weekday operator+(const days& x, const weekday& y) noexcept; |
| 496 | constexpr weekday operator-(const weekday& x, const days& y) noexcept; |
| 497 | constexpr days operator-(const weekday& x, const weekday& y) noexcept; |
| 498 | template<class charT, class traits> |
| 499 | basic_ostream<charT, traits>& |
| 500 | operator<<(basic_ostream<charT, traits>& os, const weekday& wd); |
| 501 | |
| 502 | // [time.cal.wdidx] class weekday_indexed // C++20 |
| 503 | |
| 504 | class weekday_indexed; |
| 505 | constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; |
| 506 | |
| 507 | template<class charT, class traits> |
| 508 | basic_ostream<charT, traits>& |
| 509 | operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi); |
| 510 | |
| 511 | // [time.cal.wdlast] class weekday_last // C++20 |
| 512 | class weekday_last; |
| 513 | |
| 514 | constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept; |
| 515 | |
| 516 | template<class charT, class traits> |
| 517 | basic_ostream<charT, traits>& |
| 518 | operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl); |
| 519 | |
| 520 | // [time.cal.md] class month_day // C++20 |
| 521 | class month_day; |
| 522 | |
| 523 | constexpr bool operator==(const month_day& x, const month_day& y) noexcept; |
| 524 | constexpr strong_ordering operator<=>(const month_day& x, const month_day& y) noexcept; |
| 525 | |
| 526 | template<class charT, class traits> |
| 527 | basic_ostream<charT, traits>& |
| 528 | operator<<(basic_ostream<charT, traits>& os, const month_day& md); |
| 529 | |
| 530 | // [time.cal.mdlast] class month_day_last // C++20 |
| 531 | class month_day_last; |
| 532 | |
| 533 | constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept; |
| 534 | constexpr strong_ordering operator<=>(const month_day_last& x, const month_day_last& y) noexcept; |
| 535 | |
| 536 | template<class charT, class traits> |
| 537 | basic_ostream<charT, traits>& |
| 538 | operator<<(basic_ostream<charT, traits>& os, const month_day_last& mdl); |
| 539 | |
| 540 | // [time.cal.mwd] class month_weekday // C++20 |
| 541 | class month_weekday; |
| 542 | |
| 543 | constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept; |
| 544 | |
| 545 | template<class charT, class traits> |
| 546 | basic_ostream<charT, traits>& |
| 547 | operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd); |
| 548 | |
| 549 | // [time.cal.mwdlast] class month_weekday_last // C++20 |
| 550 | class month_weekday_last; |
| 551 | |
| 552 | constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept; |
| 553 | |
| 554 | template<class charT, class traits> |
| 555 | basic_ostream<charT, traits>& |
| 556 | operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mwdl); |
| 557 | |
| 558 | |
| 559 | // [time.cal.ym] class year_month // C++20 |
| 560 | class year_month; |
| 561 | |
| 562 | constexpr bool operator==(const year_month& x, const year_month& y) noexcept; |
| 563 | constexpr strong_ordering operator<=>(const year_month& x, const year_month& y) noexcept; |
| 564 | |
| 565 | constexpr year_month operator+(const year_month& ym, const months& dm) noexcept; |
| 566 | constexpr year_month operator+(const months& dm, const year_month& ym) noexcept; |
| 567 | constexpr year_month operator-(const year_month& ym, const months& dm) noexcept; |
| 568 | constexpr months operator-(const year_month& x, const year_month& y) noexcept; |
| 569 | constexpr year_month operator+(const year_month& ym, const years& dy) noexcept; |
| 570 | constexpr year_month operator+(const years& dy, const year_month& ym) noexcept; |
| 571 | constexpr year_month operator-(const year_month& ym, const years& dy) noexcept; |
| 572 | |
| 573 | template<class charT, class traits> |
| 574 | basic_ostream<charT, traits>& |
| 575 | operator<<(basic_ostream<charT, traits>& os, const year_month& ym); |
| 576 | |
| 577 | // [time.cal.ymd] class year_month_day class // C++20 |
| 578 | year_month_day; |
| 579 | |
| 580 | constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept; |
| 581 | constexpr strong_ordering operator<=>(const year_month_day& x, const year_month_day& y) noexcept; |
| 582 | |
| 583 | constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept; |
| 584 | constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept; |
| 585 | constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept; |
| 586 | constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept; |
| 587 | constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept; |
| 588 | constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept; |
| 589 | |
| 590 | template<class charT, class traits> |
| 591 | basic_ostream<charT, traits>& |
| 592 | operator<<(basic_ostream<charT, traits>& os, const year_month_day& ymd); |
| 593 | |
| 594 | // [time.cal.ymdlast] class year_month_day_last // C++20 |
| 595 | class year_month_day_last; |
| 596 | |
| 597 | constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept; |
| 598 | constexpr strong_ordering operator<=>(const year_month_day_last_day& x, const year_month_day_last_day& y) noexcept; |
| 599 | |
| 600 | constexpr year_month_day_last |
| 601 | operator+(const year_month_day_last& ymdl, const months& dm) noexcept; |
| 602 | constexpr year_month_day_last |
| 603 | operator+(const months& dm, const year_month_day_last& ymdl) noexcept; |
| 604 | constexpr year_month_day_last |
| 605 | operator+(const year_month_day_last& ymdl, const years& dy) noexcept; |
| 606 | constexpr year_month_day_last |
| 607 | operator+(const years& dy, const year_month_day_last& ymdl) noexcept; |
| 608 | constexpr year_month_day_last |
| 609 | operator-(const year_month_day_last& ymdl, const months& dm) noexcept; |
| 610 | constexpr year_month_day_last |
| 611 | operator-(const year_month_day_last& ymdl, const years& dy) noexcept; |
| 612 | |
| 613 | template<class charT, class traits> |
| 614 | basic_ostream<charT, traits>& |
| 615 | operator<<(basic_ostream<charT, traits>& os, const year_month_day_last& ymdl); |
| 616 | |
| 617 | // [time.cal.ymwd] class year_month_weekday // C++20 |
| 618 | class year_month_weekday; |
| 619 | |
| 620 | constexpr bool operator==(const year_month_weekday& x, |
| 621 | const year_month_weekday& y) noexcept; |
| 622 | |
| 623 | constexpr year_month_weekday |
| 624 | operator+(const year_month_weekday& ymwd, const months& dm) noexcept; |
| 625 | constexpr year_month_weekday |
| 626 | operator+(const months& dm, const year_month_weekday& ymwd) noexcept; |
| 627 | constexpr year_month_weekday |
| 628 | operator+(const year_month_weekday& ymwd, const years& dy) noexcept; |
| 629 | constexpr year_month_weekday |
| 630 | operator+(const years& dy, const year_month_weekday& ymwd) noexcept; |
| 631 | constexpr year_month_weekday |
| 632 | operator-(const year_month_weekday& ymwd, const months& dm) noexcept; |
| 633 | constexpr year_month_weekday |
| 634 | operator-(const year_month_weekday& ymwd, const years& dy) noexcept; |
| 635 | |
| 636 | template<class charT, class traits> |
| 637 | basic_ostream<charT, traits>& |
| 638 | operator<<(basic_ostream<charT, traits>& os, const year_month_weekday& ymwd); |
| 639 | |
| 640 | // [time.cal.ymwdlast] class year_month_weekday_last // C++20 |
| 641 | class year_month_weekday_last; |
| 642 | |
| 643 | constexpr bool operator==(const year_month_weekday_last& x, |
| 644 | const year_month_weekday_last& y) noexcept; |
| 645 | constexpr year_month_weekday_last |
| 646 | operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept; |
| 647 | constexpr year_month_weekday_last |
| 648 | operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept; |
| 649 | constexpr year_month_weekday_last |
| 650 | operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept; |
| 651 | constexpr year_month_weekday_last |
| 652 | operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept; |
| 653 | constexpr year_month_weekday_last |
| 654 | operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept; |
| 655 | constexpr year_month_weekday_last |
| 656 | operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept; |
| 657 | |
| 658 | template<class charT, class traits> |
| 659 | basic_ostream<charT, traits>& |
| 660 | operator<<(basic_ostream<charT, traits>& os, const year_month_weekday_last& ymwdl); |
| 661 | |
| 662 | // [time.cal.operators] civil calendar conventional syntax operators // C++20 |
| 663 | constexpr year_month |
| 664 | operator/(const year& y, const month& m) noexcept; |
| 665 | constexpr year_month |
| 666 | operator/(const year& y, int m) noexcept; |
| 667 | constexpr month_day |
| 668 | operator/(const month& m, const day& d) noexcept; |
| 669 | constexpr month_day |
| 670 | operator/(const month& m, int d) noexcept; |
| 671 | constexpr month_day |
| 672 | operator/(int m, const day& d) noexcept; |
| 673 | constexpr month_day |
| 674 | operator/(const day& d, const month& m) noexcept; |
| 675 | constexpr month_day |
| 676 | operator/(const day& d, int m) noexcept; |
| 677 | constexpr month_day_last |
| 678 | operator/(const month& m, last_spec) noexcept; |
| 679 | constexpr month_day_last |
| 680 | operator/(int m, last_spec) noexcept; |
| 681 | constexpr month_day_last |
| 682 | operator/(last_spec, const month& m) noexcept; |
| 683 | constexpr month_day_last |
| 684 | operator/(last_spec, int m) noexcept; |
| 685 | constexpr month_weekday |
| 686 | operator/(const month& m, const weekday_indexed& wdi) noexcept; |
| 687 | constexpr month_weekday |
| 688 | operator/(int m, const weekday_indexed& wdi) noexcept; |
| 689 | constexpr month_weekday |
| 690 | operator/(const weekday_indexed& wdi, const month& m) noexcept; |
| 691 | constexpr month_weekday |
| 692 | operator/(const weekday_indexed& wdi, int m) noexcept; |
| 693 | constexpr month_weekday_last |
| 694 | operator/(const month& m, const weekday_last& wdl) noexcept; |
| 695 | constexpr month_weekday_last |
| 696 | operator/(int m, const weekday_last& wdl) noexcept; |
| 697 | constexpr month_weekday_last |
| 698 | operator/(const weekday_last& wdl, const month& m) noexcept; |
| 699 | constexpr month_weekday_last |
| 700 | operator/(const weekday_last& wdl, int m) noexcept; |
| 701 | constexpr year_month_day |
| 702 | operator/(const year_month& ym, const day& d) noexcept; |
| 703 | constexpr year_month_day |
| 704 | operator/(const year_month& ym, int d) noexcept; |
| 705 | constexpr year_month_day |
| 706 | operator/(const year& y, const month_day& md) noexcept; |
| 707 | constexpr year_month_day |
| 708 | operator/(int y, const month_day& md) noexcept; |
| 709 | constexpr year_month_day |
| 710 | operator/(const month_day& md, const year& y) noexcept; |
| 711 | constexpr year_month_day |
| 712 | operator/(const month_day& md, int y) noexcept; |
| 713 | constexpr year_month_day_last |
| 714 | operator/(const year_month& ym, last_spec) noexcept; |
| 715 | constexpr year_month_day_last |
| 716 | operator/(const year& y, const month_day_last& mdl) noexcept; |
| 717 | constexpr year_month_day_last |
| 718 | operator/(int y, const month_day_last& mdl) noexcept; |
| 719 | constexpr year_month_day_last |
| 720 | operator/(const month_day_last& mdl, const year& y) noexcept; |
| 721 | constexpr year_month_day_last |
| 722 | operator/(const month_day_last& mdl, int y) noexcept; |
| 723 | constexpr year_month_weekday |
| 724 | operator/(const year_month& ym, const weekday_indexed& wdi) noexcept; |
| 725 | constexpr year_month_weekday |
| 726 | operator/(const year& y, const month_weekday& mwd) noexcept; |
| 727 | constexpr year_month_weekday |
| 728 | operator/(int y, const month_weekday& mwd) noexcept; |
| 729 | constexpr year_month_weekday |
| 730 | operator/(const month_weekday& mwd, const year& y) noexcept; |
| 731 | constexpr year_month_weekday |
| 732 | operator/(const month_weekday& mwd, int y) noexcept; |
| 733 | constexpr year_month_weekday_last |
| 734 | operator/(const year_month& ym, const weekday_last& wdl) noexcept; |
| 735 | constexpr year_month_weekday_last |
| 736 | operator/(const year& y, const month_weekday_last& mwdl) noexcept; |
| 737 | constexpr year_month_weekday_last |
| 738 | operator/(int y, const month_weekday_last& mwdl) noexcept; |
| 739 | constexpr year_month_weekday_last |
| 740 | operator/(const month_weekday_last& mwdl, const year& y) noexcept; |
| 741 | constexpr year_month_weekday_last |
| 742 | operator/(const month_weekday_last& mwdl, int y) noexcept; |
| 743 | |
| 744 | // 26.9, class template hh_mm_ss |
| 745 | template <class Duration> |
| 746 | class hh_mm_ss |
| 747 | { |
| 748 | bool is_neg; // exposition only |
| 749 | chrono::hours h; // exposition only |
| 750 | chrono::minutes m; // exposition only |
| 751 | chrono::seconds s; // exposition only |
| 752 | precision ss; // exposition only |
| 753 | |
| 754 | public: |
| 755 | static unsigned constexpr fractional_width = see below; |
| 756 | using precision = see below; |
| 757 | |
| 758 | constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {} |
| 759 | constexpr explicit hh_mm_ss(Duration d) noexcept; |
| 760 | |
| 761 | constexpr bool is_negative() const noexcept; |
| 762 | constexpr chrono::hours hours() const noexcept; |
| 763 | constexpr chrono::minutes minutes() const noexcept; |
| 764 | constexpr chrono::seconds seconds() const noexcept; |
| 765 | constexpr precision subseconds() const noexcept; |
| 766 | |
| 767 | constexpr explicit operator precision() const noexcept; |
| 768 | constexpr precision to_duration() const noexcept; |
| 769 | }; |
| 770 | |
| 771 | template<class charT, class traits, class Duration> |
| 772 | basic_ostream<charT, traits>& |
| 773 | operator<<(basic_ostream<charT, traits>& os, const hh_mm_ss<Duration>& hms); // C++20 |
| 774 | |
| 775 | // 26.10, 12/24 hour functions |
| 776 | constexpr bool is_am(hours const& h) noexcept; |
| 777 | constexpr bool is_pm(hours const& h) noexcept; |
| 778 | constexpr hours make12(const hours& h) noexcept; |
| 779 | constexpr hours make24(const hours& h, bool is_pm) noexcept; |
| 780 | |
| 781 | // [time.zone.db], time zone database |
| 782 | struct tzdb { // C++20 |
| 783 | string version; |
| 784 | vector<time_zone> zones; |
| 785 | vector<time_zone_link> links; |
| 786 | vector<leap_second> leap_seconds; |
| 787 | |
| 788 | const time_zone* locate_zone(string_view tz_name) const; |
| 789 | const time_zone* current_zone() const; |
| 790 | }; |
| 791 | |
| 792 | class tzdb_list { // C++20 |
| 793 | public: |
| 794 | tzdb_list(const tzdb_list&) = delete; |
| 795 | tzdb_list& operator=(const tzdb_list&) = delete; |
| 796 | |
| 797 | // unspecified additional constructors |
| 798 | |
| 799 | class const_iterator; |
| 800 | |
| 801 | const tzdb& front() const noexcept; |
| 802 | |
| 803 | const_iterator erase_after(const_iterator p); |
| 804 | |
| 805 | const_iterator begin() const noexcept; |
| 806 | const_iterator end() const noexcept; |
| 807 | |
| 808 | const_iterator cbegin() const noexcept; |
| 809 | const_iterator cend() const noexcept; |
| 810 | }; |
| 811 | |
| 812 | // [time.zone.db.access], time zone database access |
| 813 | const tzdb& get_tzdb(); // C++20 |
| 814 | tzdb_list& get_tzdb_list(); // C++20 |
| 815 | const time_zone* locate_zone(string_view tz_name); // C++20 |
| 816 | const time_zone* current_zone() // C++20 |
| 817 | |
| 818 | // [time.zone.db.remote], remote time zone database support |
| 819 | const tzdb& reload_tzdb(); // C++20 |
| 820 | string remote_version(); // C++20 |
| 821 | |
| 822 | // [time.zone.exception], exception classes |
| 823 | class nonexistent_local_time; // C++20 |
| 824 | class ambiguous_local_time; // C++20 |
| 825 | |
| 826 | // [time.zone.info], information classes |
| 827 | struct sys_info { // C++20 |
| 828 | sys_seconds begin; |
| 829 | sys_seconds end; |
| 830 | seconds offset; |
| 831 | minutes save; |
| 832 | string abbrev; |
| 833 | }; |
| 834 | |
| 835 | template<class charT, class traits> // C++20 |
| 836 | basic_ostream<charT, traits>& |
| 837 | operator<<(basic_ostream<charT, traits>& os, const sys_info& si); |
| 838 | |
| 839 | struct local_info { // C++20 |
| 840 | static constexpr int unique = 0; |
| 841 | static constexpr int nonexistent = 1; |
| 842 | static constexpr int ambiguous = 2; |
| 843 | |
| 844 | int result; |
| 845 | sys_info first; |
| 846 | sys_info second; |
| 847 | }; |
| 848 | |
| 849 | template<class charT, class traits> // C++20 |
| 850 | basic_ostream<charT, traits>& |
| 851 | operator<<(basic_ostream<charT, traits>& os, const local_info& li); |
| 852 | |
| 853 | // [time.zone.timezone] class time_zone // C++20 |
| 854 | enum class choose {earliest, latest}; |
| 855 | class time_zone { |
| 856 | time_zone(time_zone&&) = default; |
| 857 | time_zone& operator=(time_zone&&) = default; |
| 858 | |
| 859 | // unspecified additional constructors |
| 860 | |
| 861 | string_view name() const noexcept; |
| 862 | |
| 863 | template<class Duration> |
| 864 | sys_info get_info(const sys_time<Duration>& st) const; |
| 865 | |
| 866 | template<class Duration> |
| 867 | local_info get_info(const local_time<Duration>& tp) const; |
| 868 | |
| 869 | template<class Duration> |
| 870 | sys_time<common_type_t<Duration, seconds>> |
| 871 | to_sys(const local_time<Duration>& tp) const; |
| 872 | |
| 873 | template<class Duration> |
| 874 | sys_time<common_type_t<Duration, seconds>> |
| 875 | to_sys(const local_time<Duration>& tp, choose z) const; |
| 876 | |
| 877 | template<class Duration> |
| 878 | local_time<common_type_t<Duration, seconds>> |
| 879 | to_local(const sys_time<Duration>& tp) const; |
| 880 | }; |
| 881 | bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20 |
| 882 | strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20 |
| 883 | |
| 884 | // [time.zone.zonedtraits], class template zoned_traits |
| 885 | template<class T> struct zoned_traits; // C++20 |
| 886 | |
| 887 | // [time.zone.zonedtime], class template zoned_time |
| 888 | template<class Duration, class TimeZonePtr = const time_zone*> // C++20 |
| 889 | class zoned_time; |
| 890 | |
| 891 | using zoned_seconds = zoned_time<seconds>; // C++20 |
| 892 | |
| 893 | template<class Duration1, class Duration2, class TimeZonePtr> // C++20 |
| 894 | bool operator==(const zoned_time<Duration1, TimeZonePtr>& x, |
| 895 | const zoned_time<Duration2, TimeZonePtr>& y); |
| 896 | |
| 897 | template<class charT, class traits, class Duration, class TimeZonePtr> // C++20 |
| 898 | basic_ostream<charT, traits>& |
| 899 | operator<<(basic_ostream<charT, traits>& os, |
| 900 | const zoned_time<Duration, TimeZonePtr>& t); |
| 901 | |
| 902 | // [time.zone.leap], leap second support |
| 903 | class leap_second { // C++20 |
| 904 | public: |
| 905 | leap_second(const leap_second&) = default; |
| 906 | leap_second& operator=(const leap_second&) = default; |
| 907 | |
| 908 | // unspecified additional constructors |
| 909 | |
| 910 | constexpr sys_seconds date() const noexcept; |
| 911 | constexpr seconds value() const noexcept; |
| 912 | }; |
| 913 | |
| 914 | constexpr bool operator==(const leap_second& x, const leap_second& y); // C++20 |
| 915 | constexpr strong_ordering operator<=>(const leap_second& x, const leap_second& y); |
| 916 | |
| 917 | template<class Duration> // C++20 |
| 918 | constexpr bool operator==(const leap_second& x, const sys_time<Duration>& y); |
| 919 | template<class Duration> // C++20 |
| 920 | constexpr bool operator< (const leap_second& x, const sys_time<Duration>& y); |
| 921 | template<class Duration> // C++20 |
| 922 | constexpr bool operator< (const sys_time<Duration>& x, const leap_second& y); |
| 923 | template<class Duration> // C++20 |
| 924 | constexpr bool operator> (const leap_second& x, const sys_time<Duration>& y); |
| 925 | template<class Duration> // C++20 |
| 926 | constexpr bool operator> (const sys_time<Duration>& x, const leap_second& y); |
| 927 | template<class Duration> // C++20 |
| 928 | constexpr bool operator<=(const leap_second& x, const sys_time<Duration>& y); |
| 929 | template<class Duration> // C++20 |
| 930 | constexpr bool operator<=(const sys_time<Duration>& x, const leap_second& y); |
| 931 | template<class Duration> // C++20 |
| 932 | constexpr bool operator>=(const leap_second& x, const sys_time<Duration>& y); |
| 933 | template<class Duration> // C++20 |
| 934 | constexpr bool operator>=(const sys_time<Duration>& x, const leap_second& y); |
| 935 | template<class Duration> // C++20 |
| 936 | requires three_way_comparable_with<sys_seconds, sys_time<Duration>> |
| 937 | constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y); |
| 938 | |
| 939 | // [time.zone.link], class time_zone_link |
| 940 | class time_zone_link { // C++20 |
| 941 | public: |
| 942 | time_zone_link(time_zone_link&&) = default; |
| 943 | time_zone_link& operator=(time_zone_link&&) = default; |
| 944 | |
| 945 | // unspecified additional constructors |
| 946 | |
| 947 | string_view name() const noexcept; |
| 948 | string_view target() const noexcept; |
| 949 | }; |
| 950 | |
| 951 | bool operator==(const time_zone_link& x, const time_zone_link& y); // C++20 |
| 952 | strong_ordering operator<=>(const time_zone_link& x, const time_zone_link& y); // C++20 |
| 953 | |
| 954 | } // chrono |
| 955 | |
| 956 | namespace std { |
| 957 | template<class Rep, class Period, class charT> |
| 958 | struct formatter<chrono::duration<Rep, Period>, charT>; // C++20 |
| 959 | template<class Duration, class charT> |
| 960 | struct formatter<chrono::sys_time<Duration>, charT>; // C++20 |
| 961 | template<class Duration, class charT> |
| 962 | struct formatter<chrono::utc_time<Duration>, charT>; // C++20 |
| 963 | template<class Duration, class charT> |
| 964 | struct formatter<chrono::tai_time<Duration>, charT>; // C++20 |
| 965 | template<class Duration, class charT> |
| 966 | struct formatter<chrono::gps_time<Duration>, charT>; // C++20 |
| 967 | template<class Duration, class charT> |
| 968 | struct formatter<chrono::file_time<Duration>, charT>; // C++20 |
| 969 | template<class Duration, class charT> |
| 970 | struct formatter<chrono::local_time<Duration>, charT>; // C++20 |
| 971 | template<class charT> struct formatter<chrono::day, charT>; // C++20 |
| 972 | template<class charT> struct formatter<chrono::month, charT>; // C++20 |
| 973 | template<class charT> struct formatter<chrono::year, charT>; // C++20 |
| 974 | template<class charT> struct formatter<chrono::weekday, charT>; // C++20 |
| 975 | template<class charT> struct formatter<chrono::weekday_indexed, charT>; // C++20 |
| 976 | template<class charT> struct formatter<chrono::weekday_last, charT>; // C++20 |
| 977 | template<class charT> struct formatter<chrono::month_day, charT>; // C++20 |
| 978 | template<class charT> struct formatter<chrono::month_day_last, charT>; // C++20 |
| 979 | template<class charT> struct formatter<chrono::month_weekday, charT>; // C++20 |
| 980 | template<class charT> struct formatter<chrono::month_weekday_last, charT>; // C++20 |
| 981 | template<class charT> struct formatter<chrono::year_month, charT>; // C++20 |
| 982 | template<class charT> struct formatter<chrono::year_month_day, charT>; // C++20 |
| 983 | template<class charT> struct formatter<chrono::year_month_day_last, charT>; // C++20 |
| 984 | template<class charT> struct formatter<chrono::year_month_weekday, charT>; // C++20 |
| 985 | template<class charT> struct formatter<chrono::year_month_weekday_last, charT>; // C++20 |
| 986 | template<class Rep, class Period, class charT> |
| 987 | struct formatter<chrono::hh_mm_ss<duration<Rep, Period>>, charT>; // C++20 |
| 988 | template<class charT> struct formatter<chrono::sys_info, charT>; // C++20 |
| 989 | template<class charT> struct formatter<chrono::local_info, charT>; // C++20 |
| 990 | template<class Duration, class TimeZonePtr, class charT> // C++20 |
| 991 | struct formatter<chrono::zoned_time<Duration, TimeZonePtr>, charT>; |
| 992 | } // namespace std |
| 993 | |
| 994 | namespace chrono { |
| 995 | // calendrical constants |
| 996 | inline constexpr last_spec last{}; // C++20 |
| 997 | inline constexpr chrono::weekday Sunday{0}; // C++20 |
| 998 | inline constexpr chrono::weekday Monday{1}; // C++20 |
| 999 | inline constexpr chrono::weekday Tuesday{2}; // C++20 |
| 1000 | inline constexpr chrono::weekday Wednesday{3}; // C++20 |
| 1001 | inline constexpr chrono::weekday Thursday{4}; // C++20 |
| 1002 | inline constexpr chrono::weekday Friday{5}; // C++20 |
| 1003 | inline constexpr chrono::weekday Saturday{6}; // C++20 |
| 1004 | |
| 1005 | inline constexpr chrono::month January{1}; // C++20 |
| 1006 | inline constexpr chrono::month February{2}; // C++20 |
| 1007 | inline constexpr chrono::month March{3}; // C++20 |
| 1008 | inline constexpr chrono::month April{4}; // C++20 |
| 1009 | inline constexpr chrono::month May{5}; // C++20 |
| 1010 | inline constexpr chrono::month June{6}; // C++20 |
| 1011 | inline constexpr chrono::month July{7}; // C++20 |
| 1012 | inline constexpr chrono::month August{8}; // C++20 |
| 1013 | inline constexpr chrono::month September{9}; // C++20 |
| 1014 | inline constexpr chrono::month October{10}; // C++20 |
| 1015 | inline constexpr chrono::month November{11}; // C++20 |
| 1016 | inline constexpr chrono::month December{12}; // C++20 |
| 1017 | } // chrono |
| 1018 | |
| 1019 | inline namespace literals { |
| 1020 | inline namespace chrono_literals { |
| 1021 | constexpr chrono::hours operator ""h(unsigned long long); // C++14 |
| 1022 | constexpr chrono::duration<unspecified , ratio<3600,1>> operator ""h(long double); // C++14 |
| 1023 | constexpr chrono::minutes operator ""min(unsigned long long); // C++14 |
| 1024 | constexpr chrono::duration<unspecified , ratio<60,1>> operator ""min(long double); // C++14 |
| 1025 | constexpr chrono::seconds operator ""s(unsigned long long); // C++14 |
| 1026 | constexpr chrono::duration<unspecified > operator ""s(long double); // C++14 |
| 1027 | constexpr chrono::milliseconds operator ""ms(unsigned long long); // C++14 |
| 1028 | constexpr chrono::duration<unspecified , milli> operator ""ms(long double); // C++14 |
| 1029 | constexpr chrono::microseconds operator ""us(unsigned long long); // C++14 |
| 1030 | constexpr chrono::duration<unspecified , micro> operator ""us(long double); // C++14 |
| 1031 | constexpr chrono::nanoseconds operator ""ns(unsigned long long); // C++14 |
| 1032 | constexpr chrono::duration<unspecified , nano> operator ""ns(long double); // C++14 |
| 1033 | constexpr chrono::day operator ""d(unsigned long long d) noexcept; // C++20 |
| 1034 | constexpr chrono::year operator ""y(unsigned long long y) noexcept; // C++20 |
| 1035 | } // chrono_literals |
| 1036 | } // literals |
| 1037 | |
| 1038 | } // std |
| 1039 | */ |
| 1040 | |
| 1041 | // clang-format on |
| 1042 | |
| 1043 | #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 1044 | # include <__cxx03/chrono> |
| 1045 | #else |
| 1046 | # include <__config> |
| 1047 | |
| 1048 | # include <__chrono/duration.h> |
| 1049 | # include <__chrono/file_clock.h> |
| 1050 | # include <__chrono/high_resolution_clock.h> |
| 1051 | # include <__chrono/steady_clock.h> |
| 1052 | # include <__chrono/system_clock.h> |
| 1053 | # include <__chrono/time_point.h> |
| 1054 | |
| 1055 | # if _LIBCPP_STD_VER >= 20 |
| 1056 | # include <__chrono/calendar.h> |
| 1057 | # include <__chrono/day.h> |
| 1058 | # include <__chrono/exception.h> |
| 1059 | # include <__chrono/hh_mm_ss.h> |
| 1060 | # include <__chrono/literals.h> |
| 1061 | # include <__chrono/local_info.h> |
| 1062 | # include <__chrono/month.h> |
| 1063 | # include <__chrono/month_weekday.h> |
| 1064 | # include <__chrono/monthday.h> |
| 1065 | # include <__chrono/sys_info.h> |
| 1066 | # include <__chrono/weekday.h> |
| 1067 | # include <__chrono/year.h> |
| 1068 | # include <__chrono/year_month.h> |
| 1069 | # include <__chrono/year_month_day.h> |
| 1070 | # include <__chrono/year_month_weekday.h> |
| 1071 | |
| 1072 | # if _LIBCPP_HAS_LOCALIZATION |
| 1073 | # include <__chrono/formatter.h> |
| 1074 | # include <__chrono/ostream.h> |
| 1075 | # include <__chrono/parser_std_format_spec.h> |
| 1076 | # include <__chrono/statically_widen.h> |
| 1077 | # endif |
| 1078 | |
| 1079 | # if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION |
| 1080 | # include <__chrono/gps_clock.h> |
| 1081 | # include <__chrono/leap_second.h> |
| 1082 | # include <__chrono/tai_clock.h> |
| 1083 | # include <__chrono/time_zone.h> |
| 1084 | # include <__chrono/time_zone_link.h> |
| 1085 | # include <__chrono/tzdb.h> |
| 1086 | # include <__chrono/tzdb_list.h> |
| 1087 | # include <__chrono/utc_clock.h> |
| 1088 | # include <__chrono/zoned_time.h> |
| 1089 | # endif |
| 1090 | |
| 1091 | # endif |
| 1092 | |
| 1093 | # include <version> |
| 1094 | |
| 1095 | // standard-mandated includes |
| 1096 | |
| 1097 | // [time.syn] |
| 1098 | # include <compare> |
| 1099 | |
| 1100 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 1101 | # pragma GCC system_header |
| 1102 | # endif |
| 1103 | |
| 1104 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 |
| 1105 | # include <cstdint> |
| 1106 | # include <stdexcept> |
| 1107 | # include <string_view> |
| 1108 | # endif |
| 1109 | |
| 1110 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 |
| 1111 | # include <bit> |
| 1112 | # include <concepts> |
| 1113 | # include <cstring> |
| 1114 | # include <forward_list> |
| 1115 | # include <string> |
| 1116 | # include <tuple> |
| 1117 | # include <vector> |
| 1118 | # endif |
| 1119 | |
| 1120 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20 |
| 1121 | # include <charconv> |
| 1122 | # if _LIBCPP_HAS_LOCALIZATION |
| 1123 | # include <locale> |
| 1124 | # include <ostream> |
| 1125 | # endif |
| 1126 | # endif |
| 1127 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 1128 | |
| 1129 | #endif // _LIBCPP_CHRONO |
| 1130 | |