1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: no-filesystem, no-localization, no-tzdb
12 // XFAIL: libcpp-has-no-experimental-tzdb
13 // XFAIL: availability-tzdb-missing
17 // template<class Duration1, class Duration2, class TimeZonePtr>
18 // bool operator==(const zoned_time<Duration1, TimeZonePtr>& x,
19 // const zoned_time<Duration2, TimeZonePtr>& y);
21 // Note operator!= is generated by the compiler
25 #include "test_comparisons.h"
27 int main(int, char**) {
29 std::chrono::zoned_time zt
;
30 assert(testEquality(zt
, zt
, true));
33 std::chrono::zoned_time lhs
{"UTC"};
34 std::chrono::zoned_time rhs
{"Europe/Berlin"};
35 assert(testEquality(lhs
, rhs
, false));
38 std::chrono::zoned_time lhs
{"UTC", std::chrono::sys_time
<std::chrono::seconds
>{std::chrono::seconds
{123}}};
40 assert(testEquality(lhs
,
41 std::chrono::zoned_time
{
42 std::chrono::sys_time
<std::chrono::nanoseconds
>{std::chrono::nanoseconds
{123'000'000'000}}},
44 assert(testEquality(lhs
,
45 std::chrono::zoned_time
{
46 std::chrono::sys_time
<std::chrono::nanoseconds
>{std::chrono::nanoseconds
{123'000'000'001}}},
49 assert(testEquality(lhs
,
50 std::chrono::zoned_time
{
51 std::chrono::sys_time
<std::chrono::microseconds
>{std::chrono::microseconds
{123'000'000}}},
53 assert(testEquality(lhs
,
54 std::chrono::zoned_time
{
55 std::chrono::sys_time
<std::chrono::microseconds
>{std::chrono::microseconds
{123'000'001}}},
60 std::chrono::zoned_time
{std::chrono::sys_time
<std::chrono::milliseconds
>{std::chrono::milliseconds
{123'000}}},
64 std::chrono::zoned_time
{std::chrono::sys_time
<std::chrono::milliseconds
>{std::chrono::milliseconds
{123'001}}},