| 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<> struct zoned_traits<const time_zone*>; |
| 18 | |
| 19 | // static const time_zone* default_zone(); |
| 20 | |
| 21 | #include <cassert> |
| 22 | #include <chrono> |
| 23 | #include <concepts> |
| 24 | |
| 25 | int main(int, char**) { |
| 26 | std::same_as<const std::chrono::time_zone*> decltype(auto) tz = |
| 27 | std::chrono::zoned_traits<const std::chrono::time_zone*>::default_zone(); |
| 28 | assert(tz); |
| 29 | |
| 30 | // The time zone "UTC" can be a link, this means tz->name() can be something |
| 31 | // differently. For example, "Etc/UTC". Instead validate whether same time |
| 32 | // zone is returned by comparing the addresses. |
| 33 | const std::chrono::time_zone* expected = std::chrono::locate_zone("UTC" ); |
| 34 | assert(tz == expected); |
| 35 | |
| 36 | return 0; |
| 37 | } |
| 38 | |