aboutsummaryrefslogtreecommitdiff
path: root/libcxx/test/std/time/time.zone/time.zone.zonedtime/time.zone.zonedtime.members/get_info.pass.cpp
blob: 4bce11618a1296c172242525e39624e456190e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: no-filesystem, no-localization, no-tzdb

// XFAIL: libcpp-has-no-experimental-tzdb
// XFAIL: availability-tzdb-missing

// <chrono>

// template<class Duration, class TimeZonePtr = const time_zone*>
// class zoned_time;
//
// sys_info get_info() const;

#include <cassert>
#include <chrono>
#include <concepts>

namespace cr = std::chrono;

int main(int, char**) {
  {
    cr::zoned_time<cr::seconds> zt;

    std::same_as<cr::sys_info> decltype(auto) info = zt.get_info();
    assert(info.begin == cr::sys_seconds::min());
    assert(info.end == cr::sys_seconds::max());
    assert(info.offset == cr::seconds{0});
    assert(info.save == cr::minutes{0});
    assert(info.abbrev == "UTC");
  }
  {
    const cr::zoned_time<cr::seconds> zt;

    std::same_as<cr::sys_info> decltype(auto) info = zt.get_info();
    assert(info.begin == cr::sys_seconds::min());
    assert(info.end == cr::sys_seconds::max());
    assert(info.offset == cr::seconds{0});
    assert(info.save == cr::minutes{0});
    assert(info.abbrev == "UTC");
  }

  return 0;
}