2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef SUPPORT_TEST_CHRONO_LEAP_SECOND_HPP
11 #define SUPPORT_TEST_CHRONO_LEAP_SECOND_HPP
13 // Contains helper functions to create a std::chrono::leap_second.
15 // Since the standard doesn't specify how a @ref std::chrono::leap_second is
16 // constructed this is implementation defined. To make the public API tests of
17 // the class generic this header defines helper functions to create the
20 // Note This requires every standard library implementation to write their own
21 // helper function. Vendors are encouraged to create a pull request at
22 // https://github.com/llvm/llvm-project so their specific implementation can be
25 #include "test_macros.h"
28 # error "The format header requires at least C++20"
33 #ifdef _LIBCPP_VERSION
35 # include <__utility/private_constructor_tag.h>
37 inline constexpr std::chrono::leap_second
38 test_leap_second_create(const std::chrono::sys_seconds
& date
, const std::chrono::seconds
& value
) {
39 return std::chrono::leap_second
{std::__private_constructor_tag
{}, date
, value
};
42 #else // _LIBCPP_VERSION
44 "Please create a vendor specific version of the test typedef and file a PR at https://github.com/llvm/llvm-project"
45 #endif // _LIBCPP_VERSION
47 #endif // SUPPORT_TEST_CHRONO_LEAP_SECOND_HPP