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