File indexing completed on 2026-05-03 08:13:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef _LIBCPP___CXX03___CHRONO_LEAP_SECOND_H
0013 #define _LIBCPP___CXX03___CHRONO_LEAP_SECOND_H
0014
0015 #include <__cxx03/version>
0016
0017 #if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
0018
0019 # include <__cxx03/__chrono/duration.h>
0020 # include <__cxx03/__chrono/system_clock.h>
0021 # include <__cxx03/__chrono/time_point.h>
0022 # include <__cxx03/__compare/ordering.h>
0023 # include <__cxx03/__compare/three_way_comparable.h>
0024 # include <__cxx03/__config>
0025 # include <__cxx03/__utility/private_constructor_tag.h>
0026
0027 # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0028 # pragma GCC system_header
0029 # endif
0030
0031 _LIBCPP_BEGIN_NAMESPACE_STD
0032
0033 # if _LIBCPP_STD_VER >= 20
0034
0035 namespace chrono {
0036
0037 class leap_second {
0038 public:
0039 [[nodiscard]]
0040 _LIBCPP_HIDE_FROM_ABI explicit constexpr leap_second(__private_constructor_tag, sys_seconds __date, seconds __value)
0041 : __date_(__date), __value_(__value) {}
0042
0043 _LIBCPP_HIDE_FROM_ABI leap_second(const leap_second&) = default;
0044 _LIBCPP_HIDE_FROM_ABI leap_second& operator=(const leap_second&) = default;
0045
0046 _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr sys_seconds date() const noexcept { return __date_; }
0047
0048 _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr seconds value() const noexcept { return __value_; }
0049
0050 private:
0051 sys_seconds __date_;
0052 seconds __value_;
0053 };
0054
0055 _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const leap_second& __x, const leap_second& __y) {
0056 return __x.date() == __y.date();
0057 }
0058
0059 _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const leap_second& __x, const leap_second& __y) {
0060 return __x.date() <=> __y.date();
0061 }
0062
0063 template <class _Duration>
0064 _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const leap_second& __x, const sys_time<_Duration>& __y) {
0065 return __x.date() == __y;
0066 }
0067
0068 template <class _Duration>
0069 _LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const leap_second& __x, const sys_time<_Duration>& __y) {
0070 return __x.date() < __y;
0071 }
0072
0073 template <class _Duration>
0074 _LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const sys_time<_Duration>& __x, const leap_second& __y) {
0075 return __x < __y.date();
0076 }
0077
0078 template <class _Duration>
0079 _LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const leap_second& __x, const sys_time<_Duration>& __y) {
0080 return __y < __x;
0081 }
0082
0083 template <class _Duration>
0084 _LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const sys_time<_Duration>& __x, const leap_second& __y) {
0085 return __y < __x;
0086 }
0087
0088 template <class _Duration>
0089 _LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const leap_second& __x, const sys_time<_Duration>& __y) {
0090 return !(__y < __x);
0091 }
0092
0093 template <class _Duration>
0094 _LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const sys_time<_Duration>& __x, const leap_second& __y) {
0095 return !(__y < __x);
0096 }
0097
0098 template <class _Duration>
0099 _LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const leap_second& __x, const sys_time<_Duration>& __y) {
0100 return !(__x < __y);
0101 }
0102
0103 template <class _Duration>
0104 _LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const sys_time<_Duration>& __x, const leap_second& __y) {
0105 return !(__x < __y);
0106 }
0107
0108 # ifndef _LIBCPP_COMPILER_GCC
0109
0110
0111 template <class _Duration>
0112 requires three_way_comparable_with<sys_seconds, sys_time<_Duration>>
0113 _LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const leap_second& __x, const sys_time<_Duration>& __y) {
0114 return __x.date() <=> __y;
0115 }
0116 # endif
0117
0118 }
0119
0120 # endif
0121
0122 _LIBCPP_END_NAMESPACE_STD
0123
0124 #endif
0125
0126 #endif