CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
249 lines
9.7 KiB
C++
249 lines
9.7 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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>
|
|
|
|
// zoned_time() -> zoned_time<seconds>;
|
|
//
|
|
// template<class Duration>
|
|
// zoned_time(sys_time<Duration>)
|
|
// -> zoned_time<common_type_t<Duration, seconds>>;
|
|
//
|
|
// template<class TimeZonePtrOrName>
|
|
// using time-zone-representation = // exposition only
|
|
// conditional_t<is_convertible_v<TimeZonePtrOrName, string_view>,
|
|
// const time_zone*,
|
|
// remove_cvref_t<TimeZonePtrOrName>>;
|
|
//
|
|
// template<class TimeZonePtrOrName>
|
|
// zoned_time(TimeZonePtrOrName&&)
|
|
// -> zoned_time<seconds, time-zone-representation<TimeZonePtrOrName>>;
|
|
//
|
|
// template<class TimeZonePtrOrName, class Duration>
|
|
// zoned_time(TimeZonePtrOrName&&, sys_time<Duration>)
|
|
// -> zoned_time<common_type_t<Duration, seconds>,
|
|
// time-zone-representation<TimeZonePtrOrName>>;
|
|
//
|
|
// template<class TimeZonePtrOrName, class Duration>
|
|
// zoned_time(TimeZonePtrOrName&&, local_time<Duration>,
|
|
// choose = choose::earliest)
|
|
// -> zoned_time<common_type_t<Duration, seconds>,
|
|
// time-zone-representation<TimeZonePtrOrName>>;
|
|
//
|
|
// template<class Duration, class TimeZonePtrOrName, class TimeZonePtr2>
|
|
// zoned_time(TimeZonePtrOrName&&, zoned_time<Duration, TimeZonePtr2>,
|
|
// choose = choose::earliest)
|
|
// -> zoned_time<common_type_t<Duration, seconds>,
|
|
// time-zone-representation<TimeZonePtrOrName>>;
|
|
|
|
#include <chrono>
|
|
#include <concepts>
|
|
#include <string>
|
|
|
|
#include "test_offset_time_zone.h"
|
|
|
|
namespace cr = std::chrono;
|
|
|
|
// Verify the results of the constructed object.
|
|
int main(int, char**) {
|
|
{
|
|
// zoned_time() -> zoned_time<seconds>;
|
|
cr::zoned_time zt;
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
|
|
{
|
|
// template<class Duration>
|
|
// zoned_time(sys_time<Duration>)
|
|
// -> zoned_time<common_type_t<Duration, seconds>>;
|
|
{
|
|
cr::zoned_time zt{cr::sys_time<cr::nanoseconds>{cr::nanoseconds{0}}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::nanoseconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{cr::sys_time<cr::seconds>{cr::seconds{0}}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{cr::sys_time<cr::days>{cr::days{0}}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
}
|
|
|
|
{
|
|
// template<class TimeZonePtrOrName>
|
|
// zoned_time(TimeZonePtrOrName&&)
|
|
// -> zoned_time<seconds, time-zone-representation<TimeZonePtrOrName>>;
|
|
{ // Name
|
|
{
|
|
cr::zoned_time zt{"UTC"};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{std::string{"UTC"}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{std::string_view{"UTC"}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
}
|
|
{ // TimeZonePtr
|
|
{
|
|
cr::zoned_time zt{static_cast<const cr::time_zone*>(nullptr)};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{offset_time_zone<offset_time_zone_flags::none>{}};
|
|
static_assert(
|
|
std::same_as< decltype(zt), cr::zoned_time<cr::seconds, offset_time_zone<offset_time_zone_flags::none>>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{offset_time_zone<offset_time_zone_flags::has_default_zone>{}};
|
|
static_assert(
|
|
std::same_as<decltype(zt),
|
|
cr::zoned_time<cr::seconds, offset_time_zone<offset_time_zone_flags::has_default_zone>>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{offset_time_zone<offset_time_zone_flags::has_locate_zone>{}};
|
|
static_assert(
|
|
std::same_as<decltype(zt),
|
|
cr::zoned_time<cr::seconds, offset_time_zone<offset_time_zone_flags::has_locate_zone>>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{offset_time_zone<offset_time_zone_flags::both>{}};
|
|
static_assert(
|
|
std::same_as< decltype(zt), cr::zoned_time<cr::seconds, offset_time_zone<offset_time_zone_flags::both>>>);
|
|
}
|
|
|
|
// There are no requirements on the TimeZonePtr type.
|
|
{
|
|
cr::zoned_time zt{0};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, int>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{0.0};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, double>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{cr::seconds{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, cr::seconds>>);
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
// template<class TimeZonePtrOrName, class Duration>
|
|
// zoned_time(TimeZonePtrOrName&&, sys_time<Duration>)
|
|
// -> zoned_time<common_type_t<Duration, seconds>,
|
|
// time-zone-representation<TimeZonePtrOrName>>;
|
|
{ // Name
|
|
{
|
|
cr::zoned_time zt{"UTC", cr::sys_time<cr::nanoseconds>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::nanoseconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{"UTC", cr::sys_time<cr::days>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
}
|
|
|
|
{ // TimeZonePtr
|
|
{
|
|
cr::zoned_time zt{static_cast<const cr::time_zone*>(nullptr), cr::sys_time<cr::nanoseconds>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::nanoseconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{static_cast<const cr::time_zone*>(nullptr), cr::sys_time<cr::days>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{offset_time_zone<offset_time_zone_flags::none>{}, cr::sys_time<cr::nanoseconds>{}};
|
|
static_assert(std::same_as< decltype(zt),
|
|
cr::zoned_time<cr::nanoseconds, offset_time_zone<offset_time_zone_flags::none>>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{offset_time_zone<offset_time_zone_flags::none>{}, cr::sys_time<cr::days>{}};
|
|
static_assert(
|
|
std::same_as< decltype(zt), cr::zoned_time<cr::seconds, offset_time_zone<offset_time_zone_flags::none>>>);
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
// template<class TimeZonePtrOrName, class Duration>
|
|
// zoned_time(TimeZonePtrOrName&&, local_time<Duration>,
|
|
// choose = choose::earliest)
|
|
// -> zoned_time<common_type_t<Duration, seconds>,
|
|
// time-zone-representation<TimeZonePtrOrName>>;
|
|
{ // Name
|
|
{
|
|
cr::zoned_time zt{"UTC", cr::local_time<cr::nanoseconds>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::nanoseconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{"UTC", cr::local_time<cr::days>{}, cr::choose::earliest};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
}
|
|
{ // TimeZonePtr
|
|
{
|
|
cr::zoned_time zt{cr::locate_zone("UTC"), cr::local_time<cr::nanoseconds>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::nanoseconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{cr::locate_zone("UTC"), cr::local_time<cr::days>{}, cr::choose::earliest};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
// template<class Duration, class TimeZonePtrOrName, class TimeZonePtr2>
|
|
// zoned_time(TimeZonePtrOrName&&, zoned_time<Duration, TimeZonePtr2>,
|
|
// choose = choose::earliest)
|
|
// -> zoned_time<common_type_t<Duration, seconds>,
|
|
// time-zone-representation<TimeZonePtrOrName>>;
|
|
{ // Name
|
|
{
|
|
cr::zoned_time zt{
|
|
"UTC", cr::zoned_time<cr::nanoseconds, offset_time_zone<offset_time_zone_flags::has_default_zone>>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::nanoseconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{"UTC",
|
|
cr::zoned_time<cr::days, offset_time_zone<offset_time_zone_flags::has_default_zone>>{},
|
|
cr::choose::earliest};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
}
|
|
{ // TimeZonePtr
|
|
{
|
|
cr::zoned_time zt{
|
|
cr::locate_zone("UTC"),
|
|
cr::zoned_time<cr::nanoseconds, offset_time_zone<offset_time_zone_flags::has_default_zone>>{}};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::nanoseconds, const cr::time_zone*>>);
|
|
}
|
|
{
|
|
cr::zoned_time zt{cr::locate_zone("UTC"),
|
|
cr::zoned_time<cr::days, offset_time_zone<offset_time_zone_flags::has_default_zone>>{},
|
|
cr::choose::earliest};
|
|
static_assert(std::same_as<decltype(zt), cr::zoned_time<cr::seconds, const cr::time_zone*>>);
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|