| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
| 10 | // UNSUPPORTED: no-filesystem, no-localization, no-tzdb |
| 11 | |
| 12 | // XFAIL: libcpp-has-no-experimental-tzdb |
| 13 | // XFAIL: availability-tzdb-missing |
| 14 | |
| 15 | // <chrono> |
| 16 | |
| 17 | // template<class Duration, class TimeZonePtr = const time_zone*> |
| 18 | // class zoned_time; |
| 19 | // |
| 20 | // sys_info get_info() const; |
| 21 | |
| 22 | #include <cassert> |
| 23 | #include <chrono> |
| 24 | #include <concepts> |
| 25 | |
| 26 | namespace cr = std::chrono; |
| 27 | |
| 28 | int main(int, char**) { |
| 29 | { |
| 30 | cr::zoned_time<cr::seconds> zt; |
| 31 | |
| 32 | std::same_as<cr::sys_info> decltype(auto) info = zt.get_info(); |
| 33 | assert(info.begin == cr::sys_seconds::min()); |
| 34 | assert(info.end == cr::sys_seconds::max()); |
| 35 | assert(info.offset == cr::seconds{0}); |
| 36 | assert(info.save == cr::minutes{0}); |
| 37 | assert(info.abbrev == "UTC" ); |
| 38 | } |
| 39 | { |
| 40 | const cr::zoned_time<cr::seconds> zt; |
| 41 | |
| 42 | std::same_as<cr::sys_info> decltype(auto) info = zt.get_info(); |
| 43 | assert(info.begin == cr::sys_seconds::min()); |
| 44 | assert(info.end == cr::sys_seconds::max()); |
| 45 | assert(info.offset == cr::seconds{0}); |
| 46 | assert(info.save == cr::minutes{0}); |
| 47 | assert(info.abbrev == "UTC" ); |
| 48 | } |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |