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// zoned_time(const zoned_time&) = default;
21
22#include <cassert>
23#include <chrono>
24
25int main(int, char**) {
26 std::chrono::zoned_time<std::chrono::seconds> zt{std::chrono::sys_seconds{std::chrono::seconds{42}}};
27 assert(zt.get_time_zone() == std::chrono::locate_zone("UTC"));
28 assert(zt.get_sys_time() == std::chrono::sys_seconds{std::chrono::seconds{42}});
29
30 {
31 std::chrono::zoned_time<std::chrono::seconds> copy{zt};
32 assert(copy.get_time_zone() == std::chrono::locate_zone("UTC"));
33 assert(copy.get_sys_time() == std::chrono::sys_seconds{std::chrono::seconds{42}});
34 }
35
36 {
37 std::chrono::zoned_time<std::chrono::seconds> copy = zt;
38 assert(copy.get_time_zone() == std::chrono::locate_zone("UTC"));
39 assert(copy.get_sys_time() == std::chrono::sys_seconds{std::chrono::seconds{42}});
40 }
41
42 return 0;
43}
44

source code of libcxx/test/std/time/time.zone/time.zone.zonedtime/copy.ctor.pass.cpp