summaryrefslogtreecommitdiff
path: root/third_party/libcxx/include/c++/v1/__chrono
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libcxx/include/c++/v1/__chrono')
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/calendar.h44
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/concepts.h36
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/convert_to_timespec.h51
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/convert_to_tm.h241
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/day.h112
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/duration.h570
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/exception.h135
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/file_clock.h82
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/formatter.h1035
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/gps_clock.h90
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/hh_mm_ss.h112
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/high_resolution_clock.h35
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/is_clock.h72
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/leap_second.h144
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/literals.h45
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/local_info.h50
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/month.h128
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/month_weekday.h135
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/monthday.h155
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/ostream.h354
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/parser_std_format_spec.h421
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/statically_widen.h52
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/steady_clock.h42
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/sys_info.h51
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/system_clock.h52
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/tai_clock.h108
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/time_point.h255
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/time_zone.h185
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/time_zone_link.h79
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/tzdb.h96
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/tzdb_list.h108
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/utc_clock.h163
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/weekday.h202
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/year.h131
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/year_month.h143
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/year_month_day.h371
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/year_month_weekday.h325
-rw-r--r--third_party/libcxx/include/c++/v1/__chrono/zoned_time.h244
38 files changed, 6654 insertions, 0 deletions
diff --git a/third_party/libcxx/include/c++/v1/__chrono/calendar.h b/third_party/libcxx/include/c++/v1/__chrono/calendar.h
new file mode 100644
index 0000000..bb1c5e7
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/calendar.h
@@ -0,0 +1,44 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_CALENDAR_H
+#define _LIBCPP___CHRONO_CALENDAR_H
+
+#include <__chrono/duration.h>
+#include <__chrono/time_point.h>
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+struct local_t {};
+template <class _Duration>
+using local_time = time_point<local_t, _Duration>;
+using local_seconds = local_time<seconds>;
+using local_days = local_time<days>;
+
+struct last_spec {
+ explicit last_spec() = default;
+};
+inline constexpr last_spec last{};
+
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_CALENDAR_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/concepts.h b/third_party/libcxx/include/c++/v1/__chrono/concepts.h
new file mode 100644
index 0000000..61ec256
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/concepts.h
@@ -0,0 +1,36 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_CONCEPTS_H
+#define _LIBCPP___CHRONO_CONCEPTS_H
+
+#include <__chrono/hh_mm_ss.h>
+#include <__chrono/time_point.h>
+#include <__config>
+#include <__type_traits/is_specialization.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Tp>
+concept __is_hh_mm_ss = __is_specialization_v<_Tp, chrono::hh_mm_ss>;
+
+template <class _Tp>
+concept __is_time_point = __is_specialization_v<_Tp, chrono::time_point>;
+
+#endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___CHRONO_CONCEPTS_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/convert_to_timespec.h b/third_party/libcxx/include/c++/v1/__chrono/convert_to_timespec.h
new file mode 100644
index 0000000..11e0b82
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/convert_to_timespec.h
@@ -0,0 +1,51 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H
+#define _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H
+
+#include <__chrono/duration.h>
+#include <__config>
+#include <limits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// Convert a nanoseconds duration to the given TimeSpec type, which must have
+// the same properties as std::timespec.
+template <class _TimeSpec>
+_LIBCPP_HIDE_FROM_ABI inline _TimeSpec __convert_to_timespec(const chrono::nanoseconds& __ns) {
+ using namespace chrono;
+ seconds __s = duration_cast<seconds>(__ns);
+ _TimeSpec __ts;
+ typedef decltype(__ts.tv_sec) __ts_sec;
+ const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
+
+ if (__s.count() < __ts_sec_max) {
+ __ts.tv_sec = static_cast<__ts_sec>(__s.count());
+ __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
+ } else {
+ __ts.tv_sec = __ts_sec_max;
+ __ts.tv_nsec = 999999999; // (10^9 - 1)
+ }
+
+ return __ts;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/convert_to_tm.h b/third_party/libcxx/include/c++/v1/__chrono/convert_to_tm.h
new file mode 100644
index 0000000..16e1415
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/convert_to_tm.h
@@ -0,0 +1,241 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_CONVERT_TO_TM_H
+#define _LIBCPP___CHRONO_CONVERT_TO_TM_H
+
+#include <__chrono/calendar.h>
+#include <__chrono/concepts.h>
+#include <__chrono/day.h>
+#include <__chrono/duration.h>
+#include <__chrono/file_clock.h>
+#include <__chrono/gps_clock.h>
+#include <__chrono/hh_mm_ss.h>
+#include <__chrono/local_info.h>
+#include <__chrono/month.h>
+#include <__chrono/month_weekday.h>
+#include <__chrono/monthday.h>
+#include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
+#include <__chrono/system_clock.h>
+#include <__chrono/tai_clock.h>
+#include <__chrono/time_point.h>
+#include <__chrono/utc_clock.h>
+#include <__chrono/weekday.h>
+#include <__chrono/year.h>
+#include <__chrono/year_month.h>
+#include <__chrono/year_month_day.h>
+#include <__chrono/year_month_weekday.h>
+#include <__chrono/zoned_time.h>
+#include <__concepts/same_as.h>
+#include <__config>
+#include <__format/format_error.h>
+#include <__memory/addressof.h>
+#include <__type_traits/common_type.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_specialization.h>
+#include <cstdint>
+#include <ctime>
+#include <limits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 20
+
+// Conerts a chrono date and weekday to a given _Tm type.
+//
+// This is an implementation detail for the function
+// template <class _Tm, class _ChronoT>
+// _Tm __convert_to_tm(const _ChronoT& __value)
+//
+// This manually converts the two values to the proper type. It is possible to
+// convert from sys_days to time_t and then to _Tm. But this leads to the Y2K
+// bug when time_t is a 32-bit signed integer. Chrono considers years beyond
+// the year 2038 valid, so instead do the transformation manually.
+template <class _Tm, class _Date>
+ requires(same_as<_Date, chrono::year_month_day> || same_as<_Date, chrono::year_month_day_last>)
+_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _Date& __date, chrono::weekday __weekday) {
+ _Tm __result = {};
+# ifdef __GLIBC__
+ __result.tm_zone = "UTC";
+# endif
+ __result.tm_year = static_cast<int>(__date.year()) - 1900;
+ __result.tm_mon = static_cast<unsigned>(__date.month()) - 1;
+ __result.tm_mday = static_cast<unsigned>(__date.day());
+ __result.tm_wday = static_cast<unsigned>(__weekday.c_encoding());
+ __result.tm_yday =
+ (static_cast<chrono::sys_days>(__date) -
+ static_cast<chrono::sys_days>(chrono::year_month_day{__date.year(), chrono::January, chrono::day{1}}))
+ .count();
+
+ return __result;
+}
+
+template <class _Tm, class _Duration>
+_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const chrono::sys_time<_Duration> __tp) {
+ chrono::sys_days __days = chrono::floor<chrono::days>(__tp);
+ chrono::year_month_day __ymd{__days};
+
+ _Tm __result = std::__convert_to_tm<_Tm>(chrono::year_month_day{__ymd}, chrono::weekday{__days});
+
+ uint64_t __sec =
+ chrono::duration_cast<chrono::seconds>(__tp - chrono::time_point_cast<chrono::seconds>(__days)).count();
+ __sec %= 24 * 3600;
+ __result.tm_hour = __sec / 3600;
+ __sec %= 3600;
+ __result.tm_min = __sec / 60;
+ __result.tm_sec = __sec % 60;
+
+ return __result;
+}
+
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+template <class _Tm, class _Duration>
+_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::utc_time<_Duration> __tp) {
+ _Tm __result = std::__convert_to_tm<_Tm>(chrono::utc_clock::to_sys(__tp));
+
+ if (chrono::get_leap_second_info(__tp).is_leap_second)
+ ++__result.tm_sec;
+
+ return __result;
+}
+
+template <class _Tm, class _Duration>
+_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::tai_time<_Duration> __tp) {
+ using _Rp = common_type_t<_Duration, chrono::seconds>;
+ // The time between the TAI epoch (1958-01-01) and UNIX epoch (1970-01-01).
+ // This avoids leap second conversion when going from TAI to UTC.
+ // (It also avoids issues when the date is before the UTC epoch.)
+ constexpr chrono::seconds __offset{4383 * 24 * 60 * 60};
+ return std::__convert_to_tm<_Tm>(chrono::sys_time<_Rp>{__tp.time_since_epoch() - __offset});
+}
+
+template <class _Tm, class _Duration>
+_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::gps_time<_Duration> __tp) {
+ using _Rp = common_type_t<_Duration, chrono::seconds>;
+ // The time between the GPS epoch (1980-01-06) and UNIX epoch (1970-01-01).
+ constexpr chrono::seconds __offset{3657 * 24 * 60 * 60};
+ return std::__convert_to_tm<_Tm>(chrono::sys_time<_Rp>{__tp.time_since_epoch() + __offset});
+}
+
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+// Convert a chrono (calendar) time point, or dururation to the given _Tm type,
+// which must have the same properties as std::tm.
+template <class _Tm, class _ChronoT>
+_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) {
+ _Tm __result = {};
+# ifdef __GLIBC__
+ __result.tm_zone = "UTC";
+# endif
+
+ if constexpr (__is_time_point<_ChronoT>) {
+ if constexpr (same_as<typename _ChronoT::clock, chrono::file_clock>)
+ return std::__convert_to_tm<_Tm>(_ChronoT::clock::to_sys(__value));
+ else if constexpr (same_as<typename _ChronoT::clock, chrono::local_t>)
+ return std::__convert_to_tm<_Tm>(chrono::sys_time<typename _ChronoT::duration>{__value.time_since_epoch()});
+ else {
+ // Note that some clocks have specializations __convert_to_tm for their
+ // time_point. These don't need to be added here. They do not trigger
+ // this assert.
+ static_assert(sizeof(_ChronoT) == 0, "TODO: Add the missing clock specialization");
+ }
+ } else if constexpr (chrono::__is_duration_v<_ChronoT>) {
+ // [time.format]/6
+ // ... However, if a flag refers to a "time of day" (e.g. %H, %I, %p,
+ // etc.), then a specialization of duration is interpreted as the time of
+ // day elapsed since midnight.
+
+ // Not all values can be converted to hours, it may run into ratio
+ // conversion errors. In that case the conversion to seconds works.
+ if constexpr (is_convertible_v<_ChronoT, chrono::hours>) {
+ auto __hour = chrono::floor<chrono::hours>(__value);
+ auto __sec = chrono::duration_cast<chrono::seconds>(__value - __hour);
+ __result.tm_hour = __hour.count() % 24;
+ __result.tm_min = __sec.count() / 60;
+ __result.tm_sec = __sec.count() % 60;
+ } else {
+ uint64_t __sec = chrono::duration_cast<chrono::seconds>(__value).count();
+ __sec %= 24 * 3600;
+ __result.tm_hour = __sec / 3600;
+ __sec %= 3600;
+ __result.tm_min = __sec / 60;
+ __result.tm_sec = __sec % 60;
+ }
+ } else if constexpr (same_as<_ChronoT, chrono::day>)
+ __result.tm_mday = static_cast<unsigned>(__value);
+ else if constexpr (same_as<_ChronoT, chrono::month>)
+ __result.tm_mon = static_cast<unsigned>(__value) - 1;
+ else if constexpr (same_as<_ChronoT, chrono::year>)
+ __result.tm_year = static_cast<int>(__value) - 1900;
+ else if constexpr (same_as<_ChronoT, chrono::weekday>)
+ __result.tm_wday = __value.c_encoding();
+ else if constexpr (same_as<_ChronoT, chrono::weekday_indexed> || same_as<_ChronoT, chrono::weekday_last>)
+ __result.tm_wday = __value.weekday().c_encoding();
+ else if constexpr (same_as<_ChronoT, chrono::month_day>) {
+ __result.tm_mday = static_cast<unsigned>(__value.day());
+ __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
+ } else if constexpr (same_as<_ChronoT, chrono::month_day_last>) {
+ __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
+ } else if constexpr (same_as<_ChronoT, chrono::month_weekday> || same_as<_ChronoT, chrono::month_weekday_last>) {
+ __result.tm_wday = __value.weekday_indexed().weekday().c_encoding();
+ __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
+ } else if constexpr (same_as<_ChronoT, chrono::year_month>) {
+ __result.tm_year = static_cast<int>(__value.year()) - 1900;
+ __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
+ } else if constexpr (same_as<_ChronoT, chrono::year_month_day> || same_as<_ChronoT, chrono::year_month_day_last>) {
+ return std::__convert_to_tm<_Tm>(
+ chrono::year_month_day{__value}, chrono::weekday{static_cast<chrono::sys_days>(__value)});
+ } else if constexpr (same_as<_ChronoT, chrono::year_month_weekday> ||
+ same_as<_ChronoT, chrono::year_month_weekday_last>) {
+ return std::__convert_to_tm<_Tm>(chrono::year_month_day{static_cast<chrono::sys_days>(__value)}, __value.weekday());
+ } else if constexpr (__is_hh_mm_ss<_ChronoT>) {
+ __result.tm_sec = __value.seconds().count();
+ __result.tm_min = __value.minutes().count();
+ // In libc++ hours is stored as a long. The type in std::tm is an int. So
+ // the overflow can only occur when hour uses more bits than an int
+ // provides.
+ if constexpr (sizeof(std::chrono::hours::rep) > sizeof(__result.tm_hour))
+ if (__value.hours().count() > std::numeric_limits<decltype(__result.tm_hour)>::max())
+ std::__throw_format_error("Formatting hh_mm_ss, encountered an hour overflow");
+ __result.tm_hour = __value.hours().count();
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ } else if constexpr (same_as<_ChronoT, chrono::sys_info>) {
+ // Has no time information.
+ } else if constexpr (same_as<_ChronoT, chrono::local_info>) {
+ // Has no time information.
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+ } else if constexpr (__is_specialization_v<_ChronoT, chrono::zoned_time>) {
+ return std::__convert_to_tm<_Tm>(
+ chrono::sys_time<typename _ChronoT::duration>{__value.get_local_time().time_since_epoch()});
+# endif
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ } else
+ static_assert(sizeof(_ChronoT) == 0, "Add the missing type specialization");
+
+ return __result;
+}
+
+#endif // if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___CHRONO_CONVERT_TO_TM_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/day.h b/third_party/libcxx/include/c++/v1/__chrono/day.h
new file mode 100644
index 0000000..58fdc72
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/day.h
@@ -0,0 +1,112 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_DAY_H
+#define _LIBCPP___CHRONO_DAY_H
+
+#include <__chrono/duration.h>
+#include <__compare/ordering.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class day {
+private:
+ unsigned char __d_;
+
+public:
+ day() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept
+ : __d_(static_cast<unsigned char>(__val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept {
+ ++__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day operator++(int) noexcept {
+ day __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept {
+ --__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr day operator--(int) noexcept {
+ day __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const day& __lhs, const day& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const day& __lhs, const day& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept {
+ return day(static_cast<unsigned>(__lhs) + __rhs.count());
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept {
+ return days(static_cast<int>(static_cast<unsigned>(__lhs)) - static_cast<int>(static_cast<unsigned>(__rhs)));
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator+=(const days& __dd) noexcept {
+ *this = *this + __dd;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) noexcept {
+ *this = *this - __dd;
+ return *this;
+}
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::day> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::day& __d) noexcept {
+ return static_cast<unsigned>(__d);
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_DAY_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/duration.h b/third_party/libcxx/include/c++/v1/__chrono/duration.h
new file mode 100644
index 0000000..b7762bd
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/duration.h
@@ -0,0 +1,570 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_DURATION_H
+#define _LIBCPP___CHRONO_DURATION_H
+
+#include <__compare/ordering.h>
+#include <__compare/three_way_comparable.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+#include <__type_traits/common_type.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_floating_point.h>
+#include <limits>
+#include <ratio>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+template <class _Rep, class _Period = ratio<1> >
+class duration;
+
+template <class _Tp>
+inline const bool __is_duration_v = false;
+
+template <class _Rep, class _Period>
+inline const bool __is_duration_v<duration<_Rep, _Period> > = true;
+
+template <class _Rep, class _Period>
+inline const bool __is_duration_v<const duration<_Rep, _Period> > = true;
+
+template <class _Rep, class _Period>
+inline const bool __is_duration_v<volatile duration<_Rep, _Period> > = true;
+
+template <class _Rep, class _Period>
+inline const bool __is_duration_v<const volatile duration<_Rep, _Period> > = true;
+
+} // namespace chrono
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> > {
+ typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, __ratio_gcd<_Period1, _Period2> > type;
+};
+
+namespace chrono {
+
+// duration_cast
+
+template <class _FromDuration,
+ class _ToDuration,
+ class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type,
+ bool = _Period::num == 1,
+ bool = _Period::den == 1>
+struct __duration_cast;
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
+ }
+};
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den)));
+ }
+};
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num)));
+ }
+};
+
+template <class _FromDuration, class _ToDuration, class _Period>
+struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const {
+ typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
+ return _ToDuration(static_cast<typename _ToDuration::rep>(
+ static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num) / static_cast<_Ct>(_Period::den)));
+ }
+};
+
+template <class _ToDuration, class _Rep, class _Period, __enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration
+duration_cast(const duration<_Rep, _Period>& __fd) {
+ return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
+}
+
+template <class _Rep>
+struct treat_as_floating_point : is_floating_point<_Rep> {};
+
+#if _LIBCPP_STD_VER >= 17
+template <class _Rep>
+inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>::value;
+#endif
+
+template <class _Rep>
+struct duration_values {
+public:
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT { return _Rep(0); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep max() _NOEXCEPT {
+ return numeric_limits<_Rep>::max();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT {
+ return numeric_limits<_Rep>::lowest();
+ }
+};
+
+#if _LIBCPP_STD_VER >= 17
+template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor(const duration<_Rep, _Period>& __d) {
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
+ if (__t > __d)
+ __t = __t - _ToDuration{1};
+ return __t;
+}
+
+template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_Rep, _Period>& __d) {
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
+ if (__t < __d)
+ __t = __t + _ToDuration{1};
+ return __t;
+}
+
+template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<_Rep, _Period>& __d) {
+ _ToDuration __lower = chrono::floor<_ToDuration>(__d);
+ _ToDuration __upper = __lower + _ToDuration{1};
+ auto __lower_diff = __d - __lower;
+ auto __upper_diff = __upper - __d;
+ if (__lower_diff < __upper_diff)
+ return __lower;
+ if (__lower_diff > __upper_diff)
+ return __upper;
+ return __lower.count() & 1 ? __upper : __lower;
+}
+#endif
+
+// duration
+
+template <class _Rep, class _Period>
+class duration {
+ static_assert(!__is_duration_v<_Rep>, "A duration representation can not be a duration");
+ static_assert(__is_ratio_v<_Period>, "Second template parameter of duration must be a std::ratio");
+ static_assert(_Period::num > 0, "duration period must be positive");
+
+ template <class _R1, class _R2>
+ struct __no_overflow {
+ private:
+ static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>;
+ static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>;
+ static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
+ static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
+ static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
+ static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
+ static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
+
+ template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
+ struct __mul // __overflow == false
+ {
+ static const intmax_t value = _Xp * _Yp;
+ };
+
+ template <intmax_t _Xp, intmax_t _Yp>
+ struct __mul<_Xp, _Yp, true> {
+ static const intmax_t value = 1;
+ };
+
+ public:
+ static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
+ typedef ratio<__mul<__n1, __d2, !value>::value, __mul<__n2, __d1, !value>::value> type;
+ };
+
+public:
+ typedef _Rep rep;
+ typedef typename _Period::type period;
+
+private:
+ rep __rep_;
+
+public:
+#ifndef _LIBCPP_CXX03_LANG
+ constexpr duration() = default;
+#else
+ _LIBCPP_HIDE_FROM_ABI duration() {}
+#endif
+
+ template <class _Rep2,
+ __enable_if_t<is_convertible<const _Rep2&, rep>::value &&
+ (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value),
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit duration(const _Rep2& __r) : __rep_(__r) {}
+
+ // conversions
+ template <class _Rep2,
+ class _Period2,
+ __enable_if_t<__no_overflow<_Period2, period>::value && (treat_as_floating_point<rep>::value ||
+ (__no_overflow<_Period2, period>::type::den == 1 &&
+ !treat_as_floating_point<_Rep2>::value)),
+ int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration(const duration<_Rep2, _Period2>& __d)
+ : __rep_(chrono::duration_cast<duration>(__d).count()) {}
+
+ // observer
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR rep count() const { return __rep_; }
+
+ // arithmetic
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {
+ return typename common_type<duration>::type(*this);
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {
+ return typename common_type<duration>::type(-__rep_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator++() {
+ ++__rep_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator++(int) { return duration(__rep_++); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator--() {
+ --__rep_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration operator--(int) { return duration(__rep_--); }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator+=(const duration& __d) {
+ __rep_ += __d.count();
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator-=(const duration& __d) {
+ __rep_ -= __d.count();
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator*=(const rep& __rhs) {
+ __rep_ *= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator/=(const rep& __rhs) {
+ __rep_ /= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const rep& __rhs) {
+ __rep_ %= __rhs;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 duration& operator%=(const duration& __rhs) {
+ __rep_ %= __rhs.count();
+ return *this;
+ }
+
+ // special values
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration zero() _NOEXCEPT {
+ return duration(duration_values<rep>::zero());
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration min() _NOEXCEPT {
+ return duration(duration_values<rep>::min());
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR duration max() _NOEXCEPT {
+ return duration(duration_values<rep>::max());
+ }
+};
+
+typedef duration<long long, nano> nanoseconds;
+typedef duration<long long, micro> microseconds;
+typedef duration<long long, milli> milliseconds;
+typedef duration<long long > seconds;
+typedef duration<long, ratio<60> > minutes;
+typedef duration<long, ratio<60 * 60> > hours;
+#if _LIBCPP_STD_VER >= 20
+typedef duration<int, ratio<60 * 60 * 24>> days;
+typedef duration<int, ratio<60 * 60 * 24 * 7>> weeks;
+typedef duration<int, ratio<static_cast<int>(365.2425 * 60 * 60 * 24)>> years;
+typedef duration<int, ratio<static_cast<int>(365.2425 * 60 * 60 * 24) / 12>> months;
+#endif
+// Duration ==
+
+template <class _LhsDuration, class _RhsDuration>
+struct __duration_eq {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
+ typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+ return _Ct(__lhs).count() == _Ct(__rhs).count();
+ }
+};
+
+template <class _LhsDuration>
+struct __duration_eq<_LhsDuration, _LhsDuration> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
+ return __lhs.count() == __rhs.count();
+ }
+};
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+}
+
+#if _LIBCPP_STD_VER <= 17
+
+// Duration !=
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__lhs == __rhs);
+}
+
+#endif // _LIBCPP_STD_VER <= 17
+
+// Duration <
+
+template <class _LhsDuration, class _RhsDuration>
+struct __duration_lt {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
+ typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
+ return _Ct(__lhs).count() < _Ct(__rhs).count();
+ }
+};
+
+template <class _LhsDuration>
+struct __duration_lt<_LhsDuration, _LhsDuration> {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
+ return __lhs.count() < __rhs.count();
+ }
+};
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
+}
+
+// Duration >
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return __rhs < __lhs;
+}
+
+// Duration <=
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__rhs < __lhs);
+}
+
+// Duration >=
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
+operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ return !(__lhs < __rhs);
+}
+
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+ requires three_way_comparable<common_type_t<_Rep1, _Rep2>>
+_LIBCPP_HIDE_FROM_ABI constexpr auto
+operator<=>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ using _Ct = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>;
+ return _Ct(__lhs).count() <=> _Ct(__rhs).count();
+}
+
+#endif // _LIBCPP_STD_VER >= 20
+
+// Duration +
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
+}
+
+// Duration -
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
+}
+
+// Duration *
+
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
+}
+
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<is_convertible<const _Rep1&, typename common_type<_Rep1, _Rep2>::type>::value, int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) {
+ return __d * __s;
+}
+
+// Duration /
+
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<!__is_duration_v<_Rep2> &&
+ is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
+ int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
+}
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename common_type<_Rep1, _Rep2>::type
+operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct;
+ return _Ct(__lhs).count() / _Ct(__rhs).count();
+}
+
+// Duration %
+
+template <class _Rep1,
+ class _Period,
+ class _Rep2,
+ __enable_if_t<!__is_duration_v<_Rep2> &&
+ is_convertible<const _Rep2&, typename common_type<_Rep1, _Rep2>::type>::value,
+ int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
+}
+
+template <class _Rep1, class _Period1, class _Rep2, class _Period2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
+}
+
+} // namespace chrono
+
+#if _LIBCPP_STD_VER >= 14
+// Suffixes for duration literals [time.duration.literals]
+inline namespace literals {
+inline namespace chrono_literals {
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h) {
+ return chrono::hours(static_cast<chrono::hours::rep>(__h));
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<3600, 1>>
+operator""h(long double __h) {
+ return chrono::duration<long double, ratio<3600, 1>>(__h);
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m) {
+ return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, ratio<60, 1>>
+operator""min(long double __m) {
+ return chrono::duration<long double, ratio<60, 1>>(__m);
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s) {
+ return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s) {
+ return chrono::duration<long double>(__s);
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms) {
+ return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, milli> operator""ms(long double __ms) {
+ return chrono::duration<long double, milli>(__ms);
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us) {
+ return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, micro> operator""us(long double __us) {
+ return chrono::duration<long double, micro>(__us);
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) {
+ return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
+}
+
+[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double, nano> operator""ns(long double __ns) {
+ return chrono::duration<long double, nano>(__ns);
+}
+
+} // namespace chrono_literals
+} // namespace literals
+
+namespace chrono { // hoist the literals into namespace std::chrono
+using namespace literals::chrono_literals;
+} // namespace chrono
+
+#endif // _LIBCPP_STD_VER >= 14
+
+#if _LIBCPP_STD_VER >= 26
+
+template <class _Rep, class _Period>
+ requires __has_enabled_hash<_Rep>::value
+struct hash<chrono::duration<_Rep, _Period>> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::duration<_Rep, _Period>& __d) {
+ return hash<_Rep>{}(__d.count());
+ }
+};
+
+#endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___CHRONO_DURATION_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/exception.h b/third_party/libcxx/include/c++/v1/__chrono/exception.h
new file mode 100644
index 0000000..1eb5b1b
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/exception.h
@@ -0,0 +1,135 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_EXCEPTION_H
+#define _LIBCPP___CHRONO_EXCEPTION_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/calendar.h>
+# include <__chrono/local_info.h>
+# include <__chrono/time_point.h>
+# include <__config>
+# include <__configuration/availability.h>
+# include <__verbose_abort>
+# include <format>
+# include <stdexcept>
+# include <string>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace chrono {
+
+class nonexistent_local_time : public runtime_error {
+public:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const local_time<_Duration>& __time, const local_info& __info)
+ : runtime_error{__create_message(__time, __info)} {
+ // [time.zone.exception.nonexist]/2
+ // Preconditions: i.result == local_info::nonexistent is true.
+ // The value of __info.result is not used.
+ _LIBCPP_ASSERT_PEDANTIC(__info.result == local_info::nonexistent,
+ "creating an nonexistent_local_time from a local_info that is not non-existent");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const nonexistent_local_time&) = default;
+ _LIBCPP_HIDE_FROM_ABI nonexistent_local_time& operator=(const nonexistent_local_time&) = default;
+
+ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~nonexistent_local_time() override; // exported as key function
+
+private:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
+ return std::format(
+ R"({} is in a gap between
+{} {} and
+{} {} which are both equivalent to
+{} UTC)",
+ __time,
+ local_seconds{__info.first.end.time_since_epoch()} + __info.first.offset,
+ __info.first.abbrev,
+ local_seconds{__info.second.begin.time_since_epoch()} + __info.second.offset,
+ __info.second.abbrev,
+ __info.first.end);
+ }
+};
+
+template <class _Duration>
+[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time(
+ [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
+# if _LIBCPP_HAS_EXCEPTIONS
+ throw nonexistent_local_time(__time, __info);
+# else
+ _LIBCPP_VERBOSE_ABORT("nonexistent_local_time was thrown in -fno-exceptions mode");
+# endif
+}
+
+class ambiguous_local_time : public runtime_error {
+public:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const local_time<_Duration>& __time, const local_info& __info)
+ : runtime_error{__create_message(__time, __info)} {
+ // [time.zone.exception.ambig]/2
+ // Preconditions: i.result == local_info::ambiguous is true.
+ // The value of __info.result is not used.
+ _LIBCPP_ASSERT_PEDANTIC(__info.result == local_info::ambiguous,
+ "creating an ambiguous_local_time from a local_info that is not ambiguous");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const ambiguous_local_time&) = default;
+ _LIBCPP_HIDE_FROM_ABI ambiguous_local_time& operator=(const ambiguous_local_time&) = default;
+
+ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~ambiguous_local_time() override; // exported as key function
+
+private:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
+ return std::format(
+ // There are two spaces after the full-stop; this has been verified
+ // in the sources of the Standard.
+ R"({0} is ambiguous. It could be
+{0} {1} == {2} UTC or
+{0} {3} == {4} UTC)",
+ __time,
+ __info.first.abbrev,
+ __time - __info.first.offset,
+ __info.second.abbrev,
+ __time - __info.second.offset);
+ }
+};
+
+template <class _Duration>
+[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time(
+ [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
+# if _LIBCPP_HAS_EXCEPTIONS
+ throw ambiguous_local_time(__time, __info);
+# else
+ _LIBCPP_VERBOSE_ABORT("ambiguous_local_time was thrown in -fno-exceptions mode");
+# endif
+}
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_EXCEPTION_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/file_clock.h b/third_party/libcxx/include/c++/v1/__chrono/file_clock.h
new file mode 100644
index 0000000..968f652
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/file_clock.h
@@ -0,0 +1,82 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_FILE_CLOCK_H
+#define _LIBCPP___CHRONO_FILE_CLOCK_H
+
+#include <__chrono/duration.h>
+#include <__chrono/system_clock.h>
+#include <__chrono/time_point.h>
+#include <__config>
+#include <ratio>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_CXX03_LANG
+_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
+struct _FilesystemClock;
+_LIBCPP_END_NAMESPACE_FILESYSTEM
+#endif // !_LIBCPP_CXX03_LANG
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+// [time.clock.file], type file_clock
+using file_clock = filesystem::_FilesystemClock;
+
+template <class _Duration>
+using file_time = time_point<file_clock, _Duration>;
+
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#ifndef _LIBCPP_CXX03_LANG
+_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
+struct _FilesystemClock {
+# if _LIBCPP_HAS_INT128
+ typedef __int128_t rep;
+ typedef nano period;
+# else
+ typedef long long rep;
+ typedef nano period;
+# endif
+
+ typedef chrono::duration<rep, period> duration;
+ typedef chrono::time_point<_FilesystemClock> time_point;
+
+ _LIBCPP_EXPORTED_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
+
+ [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI static time_point now() noexcept;
+
+# if _LIBCPP_STD_VER >= 20
+ template <class _Duration>
+ [[nodiscard]]
+ _LIBCPP_HIDE_FROM_ABI static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
+ return chrono::sys_time<_Duration>(__t.time_since_epoch());
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static chrono::file_time<_Duration>
+ from_sys(const chrono::sys_time<_Duration>& __t) {
+ return chrono::file_time<_Duration>(__t.time_since_epoch());
+ }
+# endif // _LIBCPP_STD_VER >= 20
+};
+_LIBCPP_END_NAMESPACE_FILESYSTEM
+#endif // !_LIBCPP_CXX03_LANG
+
+#endif // _LIBCPP___CHRONO_FILE_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/formatter.h b/third_party/libcxx/include/c++/v1/__chrono/formatter.h
new file mode 100644
index 0000000..4975839
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/formatter.h
@@ -0,0 +1,1035 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_FORMATTER_H
+#define _LIBCPP___CHRONO_FORMATTER_H
+
+#include <__config>
+
+#if _LIBCPP_HAS_LOCALIZATION
+
+# include <__algorithm/ranges_copy.h>
+# include <__chrono/calendar.h>
+# include <__chrono/concepts.h>
+# include <__chrono/convert_to_tm.h>
+# include <__chrono/day.h>
+# include <__chrono/duration.h>
+# include <__chrono/file_clock.h>
+# include <__chrono/gps_clock.h>
+# include <__chrono/hh_mm_ss.h>
+# include <__chrono/local_info.h>
+# include <__chrono/month.h>
+# include <__chrono/month_weekday.h>
+# include <__chrono/monthday.h>
+# include <__chrono/ostream.h>
+# include <__chrono/parser_std_format_spec.h>
+# include <__chrono/statically_widen.h>
+# include <__chrono/sys_info.h>
+# include <__chrono/system_clock.h>
+# include <__chrono/tai_clock.h>
+# include <__chrono/time_point.h>
+# include <__chrono/utc_clock.h>
+# include <__chrono/weekday.h>
+# include <__chrono/year.h>
+# include <__chrono/year_month.h>
+# include <__chrono/year_month_day.h>
+# include <__chrono/year_month_weekday.h>
+# include <__chrono/zoned_time.h>
+# include <__concepts/arithmetic.h>
+# include <__concepts/same_as.h>
+# include <__format/concepts.h>
+# include <__format/format_error.h>
+# include <__format/format_functions.h>
+# include <__format/format_parse_context.h>
+# include <__format/formatter.h>
+# include <__format/parser_std_format_spec.h>
+# include <__format/write_escaped.h>
+# include <__iterator/istreambuf_iterator.h>
+# include <__iterator/ostreambuf_iterator.h>
+# include <__locale_dir/time.h>
+# include <__memory/addressof.h>
+# include <__type_traits/is_specialization.h>
+# include <cmath>
+# include <ctime>
+# include <limits>
+# include <sstream>
+# include <string_view>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace __formatter {
+
+/// Formats a time based on a tm struct.
+///
+/// This formatter passes the formatting to time_put which uses strftime. When
+/// the value is outside the valid range it's unspecified what strftime will
+/// output. For example weekday 8 can print 1 when the day is processed modulo
+/// 7 since that handles the Sunday for 0-based weekday. It can also print 8 if
+/// 7 is handled as a special case.
+///
+/// The Standard doesn't specify what to do in this case so the result depends
+/// on the result of the underlying code.
+///
+/// \pre When the (abbreviated) weekday or month name are used, the caller
+/// validates whether the value is valid. So the caller handles that
+/// requirement of Table 97: Meaning of conversion specifiers
+/// [tab:time.format.spec].
+///
+/// When no chrono-specs are provided it uses the stream formatter.
+
+// For tiny ratios it's not possible to convert a duration to a hh_mm_ss. This
+// fails compile-time due to the limited precision of the ratio (64-bit is too
+// small). Therefore a duration uses its own conversion.
+template <class _CharT, class _Rep, class _Period>
+_LIBCPP_HIDE_FROM_ABI void
+__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::duration<_Rep, _Period>& __value) {
+ __sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc()).decimal_point();
+
+ using __duration = chrono::duration<_Rep, _Period>;
+
+ auto __fraction = __value - chrono::duration_cast<chrono::seconds>(__value);
+ // Converts a negative fraction to its positive value.
+ if (__value < chrono::seconds{0} && __fraction != __duration{0})
+ __fraction += chrono::seconds{1};
+ if constexpr (chrono::treat_as_floating_point_v<_Rep>)
+ // When the floating-point value has digits itself they are ignored based
+ // on the wording in [tab:time.format.spec]
+ // If the precision of the input cannot be exactly represented with
+ // seconds, then the format is a decimal floating-point number with a
+ // fixed format and a precision matching that of the precision of the
+ // input (or to a microseconds precision if the conversion to
+ // floating-point decimal seconds cannot be made within 18 fractional
+ // digits).
+ //
+ // This matches the behaviour of MSVC STL, fmtlib interprets this
+ // differently and uses 3 decimals.
+ // https://godbolt.org/z/6dsbnW8ba
+ std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"),
+ chrono::duration_cast<typename chrono::hh_mm_ss<__duration>::precision>(__fraction).count(),
+ chrono::hh_mm_ss<__duration>::fractional_width);
+ else
+ std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}}"),
+ chrono::duration_cast<typename chrono::hh_mm_ss<__duration>::precision>(__fraction).count(),
+ chrono::hh_mm_ss<__duration>::fractional_width);
+}
+
+template <class _CharT, __is_time_point _Tp>
+_LIBCPP_HIDE_FROM_ABI void __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const _Tp& __value) {
+ __formatter::__format_sub_seconds(__sstr, __value.time_since_epoch());
+}
+
+template <class _CharT, class _Duration>
+_LIBCPP_HIDE_FROM_ABI void
+__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::hh_mm_ss<_Duration>& __value) {
+ __sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc()).decimal_point();
+ if constexpr (chrono::treat_as_floating_point_v<typename _Duration::rep>)
+ std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"),
+ __value.subseconds().count(),
+ __value.fractional_width);
+ else
+ std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}}"),
+ __value.subseconds().count(),
+ __value.fractional_width);
+}
+
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+template <class _CharT, class _Duration, class _TimeZonePtr>
+_LIBCPP_HIDE_FROM_ABI void
+__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) {
+ __formatter::__format_sub_seconds(__sstr, __value.get_local_time().time_since_epoch());
+}
+# endif
+
+template <class _Tp>
+consteval bool __use_fraction() {
+ if constexpr (__is_time_point<_Tp>)
+ return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+ else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
+ return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
+# endif
+ else if constexpr (chrono::__is_duration_v<_Tp>)
+ return chrono::hh_mm_ss<_Tp>::fractional_width;
+ else if constexpr (__is_hh_mm_ss<_Tp>)
+ return _Tp::fractional_width;
+ else
+ return false;
+}
+
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI void __format_year(basic_stringstream<_CharT>& __sstr, int __year) {
+ if (__year < 0) {
+ __sstr << _CharT('-');
+ __year = -__year;
+ }
+
+ // TODO FMT Write an issue
+ // If the result has less than four digits it is zero-padded with 0 to two digits.
+ // is less -> has less
+ // left-padded -> zero-padded, otherwise the proper value would be 000-0.
+
+ // Note according to the wording it should be left padded, which is odd.
+ __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:04}"), __year);
+}
+
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI void __format_century(basic_stringstream<_CharT>& __sstr, int __year) {
+ // TODO FMT Write an issue
+ // [tab:time.format.spec]
+ // %C The year divided by 100 using floored division. If the result is a
+ // single decimal digit, it is prefixed with 0.
+
+ bool __negative = __year < 0;
+ int __century = (__year - (99 * __negative)) / 100; // floored division
+ __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), __century);
+}
+
+// Implements the %z format specifier according to [tab:time.format.spec], where
+// '__modifier' signals %Oz or %Ez were used. (Both modifiers behave the same,
+// so there is no need to distinguish between them.)
+template <class _CharT>
+_LIBCPP_HIDE_FROM_ABI void
+__format_zone_offset(basic_stringstream<_CharT>& __sstr, chrono::seconds __offset, bool __modifier) {
+ if (__offset < 0s) {
+ __sstr << _CharT('-');
+ __offset = -__offset;
+ } else {
+ __sstr << _CharT('+');
+ }
+
+ chrono::hh_mm_ss __hms{__offset};
+ std::ostreambuf_iterator<_CharT> __out_it{__sstr};
+ // Note HMS does not allow formatting hours > 23, but the offset is not limited to 24H.
+ std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), __hms.hours().count());
+ if (__modifier)
+ __sstr << _CharT(':');
+ std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), __hms.minutes().count());
+}
+
+// Helper to store the time zone information needed for formatting.
+struct _LIBCPP_HIDE_FROM_ABI __time_zone {
+ // Typically these abbreviations are short and fit in the string's internal
+ // buffer.
+ string __abbrev;
+ chrono::seconds __offset;
+};
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const _Tp& __value) {
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ if constexpr (same_as<_Tp, chrono::sys_info>)
+ return {__value.abbrev, __value.offset};
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+ else if constexpr (__is_time_point<_Tp> && requires { requires same_as<typename _Tp::clock, chrono::tai_clock>; })
+ return {"TAI", chrono::seconds{0}};
+ else if constexpr (__is_time_point<_Tp> && requires { requires same_as<typename _Tp::clock, chrono::gps_clock>; })
+ return {"GPS", chrono::seconds{0}};
+ else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
+ return __formatter::__convert_to_time_zone(__value.get_info());
+# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+ else
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ return {"UTC", chrono::seconds{0}};
+}
+
+template <class _CharT, class _Tp>
+_LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
+ basic_stringstream<_CharT>& __sstr, const _Tp& __value, basic_string_view<_CharT> __chrono_specs) {
+ tm __t = std::__convert_to_tm<tm>(__value);
+ __time_zone __z = __formatter::__convert_to_time_zone(__value);
+ const auto& __facet = std::use_facet<time_put<_CharT>>(__sstr.getloc());
+ for (auto __it = __chrono_specs.begin(); __it != __chrono_specs.end(); ++__it) {
+ if (*__it == _CharT('%')) {
+ auto __s = __it;
+ ++__it;
+ // We only handle the types that can't be directly handled by time_put.
+ // (as an optimization n, t, and % are also handled directly.)
+ switch (*__it) {
+ case _CharT('n'):
+ __sstr << _CharT('\n');
+ break;
+ case _CharT('t'):
+ __sstr << _CharT('\t');
+ break;
+ case _CharT('%'):
+ __sstr << *__it;
+ break;
+
+ case _CharT('C'): {
+ // strftime's output is only defined in the range [00, 99].
+ int __year = __t.tm_year + 1900;
+ if (__year < 1000 || __year > 9999)
+ __formatter::__format_century(__sstr, __year);
+ else
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ } break;
+
+ case _CharT('j'):
+ if constexpr (chrono::__is_duration_v<_Tp>)
+ // Converting a duration where the period has a small ratio to days
+ // may fail to compile. This due to loss of precision in the
+ // conversion. In order to avoid that issue convert to seconds as
+ // an intemediate step.
+ __sstr << chrono::duration_cast<chrono::days>(chrono::duration_cast<chrono::seconds>(__value)).count();
+ else
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ break;
+
+ case _CharT('q'):
+ if constexpr (chrono::__is_duration_v<_Tp>) {
+ __sstr << chrono::__units_suffix<_CharT, typename _Tp::period>();
+ break;
+ }
+ __builtin_unreachable();
+
+ case _CharT('Q'):
+ // TODO FMT Determine the proper ideas
+ // - Should it honour the precision?
+ // - Shoult it honour the locale setting for the separators?
+ // The wording for Q doesn't use the word locale and the effect of
+ // precision is unspecified.
+ //
+ // MSVC STL ignores precision but uses separator
+ // FMT honours precision and has a bug for separator
+ // https://godbolt.org/z/78b7sMxns
+ if constexpr (chrono::__is_duration_v<_Tp>) {
+ __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{}"), __value.count());
+ break;
+ }
+ __builtin_unreachable();
+
+ case _CharT('S'):
+ case _CharT('T'):
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ if constexpr (__formatter::__use_fraction<_Tp>())
+ __formatter::__format_sub_seconds(__sstr, __value);
+ break;
+
+ // Unlike time_put and strftime the formatting library requires %Y
+ //
+ // [tab:time.format.spec]
+ // The year as a decimal number. If the result is less than four digits
+ // it is left-padded with 0 to four digits.
+ //
+ // This means years in the range (-1000, 1000) need manual formatting.
+ // It's unclear whether %EY needs the same treatment. For example the
+ // Japanese EY contains the era name and year. This is zero-padded to 2
+ // digits in time_put (note that older glibc versions didn't do
+ // padding.) However most eras won't reach 100 years, let alone 1000.
+ // So padding to 4 digits seems unwanted for Japanese.
+ //
+ // The same applies to %Ex since that too depends on the era.
+ //
+ // %x the locale's date representation is currently doesn't handle the
+ // zero-padding too.
+ //
+ // The 4 digits can be implemented better at a later time. On POSIX
+ // systems the required information can be extracted by nl_langinfo
+ // https://man7.org/linux/man-pages/man3/nl_langinfo.3.html
+ //
+ // Note since year < -1000 is expected to be rare it uses the more
+ // expensive year routine.
+ //
+ // TODO FMT evaluate the comment above.
+
+# if defined(__GLIBC__) || defined(_AIX) || defined(_WIN32)
+ case _CharT('y'):
+ // Glibc fails for negative values, AIX for positive values too.
+ __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), (std::abs(__t.tm_year + 1900)) % 100);
+ break;
+# endif // defined(__GLIBC__) || defined(_AIX) || defined(_WIN32)
+
+ case _CharT('Y'):
+ // Depending on the platform's libc the range of supported years is
+ // limited. Instead of of testing all conditions use the internal
+ // implementation unconditionally.
+ __formatter::__format_year(__sstr, __t.tm_year + 1900);
+ break;
+
+ case _CharT('F'):
+ // Depending on the platform's libc the range of supported years is
+ // limited. Instead of testing all conditions use the internal
+ // implementation unconditionally.
+ __formatter::__format_year(__sstr, __t.tm_year + 1900);
+ __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "-{:02}-{:02}"), __t.tm_mon + 1, __t.tm_mday);
+ break;
+
+ case _CharT('z'):
+ __formatter::__format_zone_offset(__sstr, __z.__offset, false);
+ break;
+
+ case _CharT('Z'):
+ // __abbrev is always a char so the copy may convert.
+ ranges::copy(__z.__abbrev, std::ostreambuf_iterator<_CharT>{__sstr});
+ break;
+
+ case _CharT('O'):
+ if constexpr (__formatter::__use_fraction<_Tp>()) {
+ // Handle OS using the normal representation for the non-fractional
+ // part. There seems to be no locale information regarding how the
+ // fractional part should be formatted.
+ if (*(__it + 1) == 'S') {
+ ++__it;
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ __formatter::__format_sub_seconds(__sstr, __value);
+ break;
+ }
+ }
+
+ // Oz produces the same output as Ez below.
+ [[fallthrough]];
+ case _CharT('E'):
+ ++__it;
+ if (*__it == 'z') {
+ __formatter::__format_zone_offset(__sstr, __z.__offset, true);
+ break;
+ }
+ [[fallthrough]];
+ default:
+ __facet.put(
+ {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
+ break;
+ }
+ } else {
+ __sstr << *__it;
+ }
+ }
+}
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) {
+ if constexpr (__is_time_point<_Tp>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::day>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_day>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_day_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_weekday>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::year_month>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::year_month_day>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
+ return __value.weekday().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
+ return __value.weekday().ok();
+ else if constexpr (__is_hh_mm_ss<_Tp>)
+ return true;
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else if constexpr (same_as<_Tp, chrono::sys_info>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::local_info>)
+ return true;
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+ else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
+ return true;
+# endif
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else
+ static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
+}
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) {
+ if constexpr (__is_time_point<_Tp>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::day>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
+ return __value.weekday().ok();
+ else if constexpr (same_as<_Tp, chrono::weekday_last>)
+ return __value.weekday().ok();
+ else if constexpr (same_as<_Tp, chrono::month_day>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_day_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_weekday>)
+ return __value.weekday_indexed().ok();
+ else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
+ return __value.weekday_indexed().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::year_month_day>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
+ return __value.weekday().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
+ return __value.weekday().ok();
+ else if constexpr (__is_hh_mm_ss<_Tp>)
+ return true;
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else if constexpr (same_as<_Tp, chrono::sys_info>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::local_info>)
+ return true;
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+ else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
+ return true;
+# endif
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else
+ static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
+}
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) {
+ if constexpr (__is_time_point<_Tp>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::day>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_day>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_day_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_weekday>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::year_month>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::year_month_day>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
+ return __value.ok();
+ else if constexpr (__is_hh_mm_ss<_Tp>)
+ return true;
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else if constexpr (same_as<_Tp, chrono::sys_info>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::local_info>)
+ return true;
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+ else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
+ return true;
+# endif
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else
+ static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
+}
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) {
+ if constexpr (__is_time_point<_Tp>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::day>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month>)
+ return __value.ok();
+ else if constexpr (same_as<_Tp, chrono::year>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::weekday_last>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::month_day>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::month_day_last>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::month_weekday>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_day>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
+ return __value.month().ok();
+ else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
+ return __value.month().ok();
+ else if constexpr (__is_hh_mm_ss<_Tp>)
+ return true;
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else if constexpr (same_as<_Tp, chrono::sys_info>)
+ return true;
+ else if constexpr (same_as<_Tp, chrono::local_info>)
+ return true;
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+ else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
+ return true;
+# endif
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+ else
+ static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
+}
+
+template <class _CharT, class _Tp, class _FormatContext>
+_LIBCPP_HIDE_FROM_ABI auto
+__format_chrono(const _Tp& __value,
+ _FormatContext& __ctx,
+ __format_spec::__parsed_specifications<_CharT> __specs,
+ basic_string_view<_CharT> __chrono_specs) {
+ basic_stringstream<_CharT> __sstr;
+ // [time.format]/2
+ // 2.1 - the "C" locale if the L option is not present in chrono-format-spec, otherwise
+ // 2.2 - the locale passed to the formatting function if any, otherwise
+ // 2.3 - the global locale.
+ // Note that the __ctx's locale() call does 2.2 and 2.3.
+ if (__specs.__chrono_.__locale_specific_form_)
+ __sstr.imbue(__ctx.locale());
+ else
+ __sstr.imbue(locale::classic());
+
+ if (__chrono_specs.empty())
+ __sstr << __value;
+ else {
+ if constexpr (chrono::__is_duration_v<_Tp>) {
+ // A duration can be a user defined arithmetic type. Users may specialize
+ // numeric_limits, but they may not specialize is_signed.
+ if constexpr (numeric_limits<typename _Tp::rep>::is_signed) {
+ if (__value < __value.zero()) {
+ __sstr << _CharT('-');
+ __formatter::__format_chrono_using_chrono_specs(__sstr, -__value, __chrono_specs);
+ } else
+ __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs);
+ } else
+ __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs);
+ // TODO FMT When keeping the precision it will truncate the string.
+ // Note that the behaviour what the precision does isn't specified.
+ __specs.__precision_ = -1;
+ } else {
+ // Test __weekday_name_ before __weekday_ to give a better error.
+ if (__specs.__chrono_.__weekday_name_ && !__formatter::__weekday_name_ok(__value))
+ std::__throw_format_error("Formatting a weekday name needs a valid weekday");
+
+ if (__specs.__chrono_.__weekday_ && !__formatter::__weekday_ok(__value))
+ std::__throw_format_error("Formatting a weekday needs a valid weekday");
+
+ if (__specs.__chrono_.__day_of_year_ && !__formatter::__date_ok(__value))
+ std::__throw_format_error("Formatting a day of year needs a valid date");
+
+ if (__specs.__chrono_.__week_of_year_ && !__formatter::__date_ok(__value))
+ std::__throw_format_error("Formatting a week of year needs a valid date");
+
+ if (__specs.__chrono_.__month_name_ && !__formatter::__month_name_ok(__value))
+ std::__throw_format_error("Formatting a month name from an invalid month number");
+
+ if constexpr (__is_hh_mm_ss<_Tp>) {
+ // Note this is a pedantic intepretation of the Standard. A hh_mm_ss
+ // is no longer a time_of_day and can store an arbitrary number of
+ // hours. A number of hours in a 12 or 24 hour clock can't represent
+ // 24 hours or more. The functions std::chrono::make12 and
+ // std::chrono::make24 reaffirm this view point.
+ //
+ // Interestingly this will be the only output stream function that
+ // throws.
+ //
+ // TODO FMT The wording probably needs to be adapted to
+ // - The displayed hours is hh_mm_ss.hours() % 24
+ // - It should probably allow %j in the same fashion as duration.
+ // - The stream formatter should change its output when hours >= 24
+ // - Write it as not valid,
+ // - or write the number of days.
+ if (__specs.__chrono_.__hour_ && __value.hours().count() > 23)
+ std::__throw_format_error("Formatting a hour needs a valid value");
+
+ if (__value.is_negative())
+ __sstr << _CharT('-');
+ }
+
+ __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs);
+ }
+ }
+
+ return __formatter::__write_string(__sstr.view(), __ctx.out(), __specs);
+}
+
+} // namespace __formatter
+
+template <__fmt_char_type _CharT>
+struct __formatter_chrono {
+public:
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator
+ __parse(_ParseContext& __ctx, __format_spec::__fields __fields, __format_spec::__flags __flags) {
+ return __parser_.__parse(__ctx, __fields, __flags);
+ }
+
+ template <class _Tp, class _FormatContext>
+ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _Tp& __value, _FormatContext& __ctx) const {
+ return __formatter::__format_chrono(
+ __value, __ctx, __parser_.__parser_.__get_parsed_chrono_specifications(__ctx), __parser_.__chrono_specs_);
+ }
+
+ __format_spec::__parser_chrono<_CharT> __parser_;
+};
+
+template <class _Duration, __fmt_char_type _CharT>
+struct formatter<chrono::sys_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
+ }
+};
+
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+template <class _Duration, __fmt_char_type _CharT>
+struct formatter<chrono::utc_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
+ }
+};
+
+template <class _Duration, __fmt_char_type _CharT>
+struct formatter<chrono::tai_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
+ }
+};
+
+template <class _Duration, __fmt_char_type _CharT>
+struct formatter<chrono::gps_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
+ }
+};
+
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+
+template <class _Duration, __fmt_char_type _CharT>
+struct formatter<chrono::file_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
+ }
+};
+
+template <class _Duration, __fmt_char_type _CharT>
+struct formatter<chrono::local_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ // The flags are not __clock since there is no associated time-zone.
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date_time);
+ }
+};
+
+template <class _Rep, class _Period, __fmt_char_type _CharT>
+struct formatter<chrono::duration<_Rep, _Period>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ // [time.format]/1
+ // Giving a precision specification in the chrono-format-spec is valid only
+ // for std::chrono::duration types where the representation type Rep is a
+ // floating-point type. For all other Rep types, an exception of type
+ // format_error is thrown if the chrono-format-spec contains a precision
+ // specification.
+ //
+ // Note this doesn't refer to chrono::treat_as_floating_point_v<_Rep>.
+ if constexpr (std::floating_point<_Rep>)
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono_fractional, __format_spec::__flags::__duration);
+ else
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__duration);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::day, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__day);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::month, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::year, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__year);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::weekday, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::weekday_indexed, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::weekday_last, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::month_day, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_day);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::month_day_last, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::month_weekday, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_weekday);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_weekday);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::year_month, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__year_month);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::year_month_day, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::year_month_day_last, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::year_month_weekday, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::year_month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
+ }
+};
+
+template <class _Duration, __fmt_char_type _CharT>
+struct formatter<chrono::hh_mm_ss<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__time);
+ }
+};
+
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+template <__fmt_char_type _CharT>
+struct formatter<chrono::sys_info, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__time_zone);
+ }
+};
+
+template <__fmt_char_type _CharT>
+struct formatter<chrono::local_info, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags{});
+ }
+};
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+// Note due to how libc++'s formatters are implemented there is no need to add
+// the exposition only local-time-format-t abstraction.
+template <class _Duration, class _TimeZonePtr, __fmt_char_type _CharT>
+struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _CharT> : public __formatter_chrono<_CharT> {
+public:
+ using _Base _LIBCPP_NODEBUG = __formatter_chrono<_CharT>;
+
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+ return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
+ }
+};
+# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# endif // if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_LOCALIZATION
+
+#endif // _LIBCPP___CHRONO_FORMATTER_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/gps_clock.h b/third_party/libcxx/include/c++/v1/__chrono/gps_clock.h
new file mode 100644
index 0000000..2e220ca
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/gps_clock.h
@@ -0,0 +1,90 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_GPS_CLOCK_H
+#define _LIBCPP___CHRONO_GPS_CLOCK_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__assert>
+# include <__chrono/duration.h>
+# include <__chrono/time_point.h>
+# include <__chrono/utc_clock.h>
+# include <__config>
+# include <__type_traits/common_type.h>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_PUSH_MACROS
+# include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+class gps_clock;
+
+template <class _Duration>
+using gps_time = time_point<gps_clock, _Duration>;
+using gps_seconds = gps_time<seconds>;
+
+class gps_clock {
+public:
+ using rep = utc_clock::rep;
+ using period = utc_clock::period;
+ using duration = chrono::duration<rep, period>;
+ using time_point = chrono::time_point<gps_clock>;
+ static constexpr bool is_steady = false; // The utc_clock is not steady.
+
+ // The static difference between UTC and GPS time as specified in the Standard.
+ static constexpr chrono::seconds __offset{315964809};
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static time_point now() { return from_utc(utc_clock::now()); }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static utc_time<common_type_t<_Duration, seconds>>
+ to_utc(const gps_time<_Duration>& __time) noexcept {
+ using _Rp = common_type_t<_Duration, seconds>;
+ _Duration __time_since_epoch = __time.time_since_epoch();
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__time_since_epoch >= utc_time<_Rp>::min().time_since_epoch() + __offset,
+ "the GPS to UTC conversion would underflow");
+
+ return utc_time<_Rp>{__time_since_epoch + __offset};
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static gps_time<common_type_t<_Duration, seconds>>
+ from_utc(const utc_time<_Duration>& __time) noexcept {
+ using _Rp = common_type_t<_Duration, seconds>;
+ _Duration __time_since_epoch = __time.time_since_epoch();
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__time_since_epoch <= utc_time<_Rp>::max().time_since_epoch() - __offset,
+ "the UTC to GPS conversion would overflow");
+
+ return gps_time<_Rp>{__time_since_epoch - __offset};
+ }
+};
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_GPS_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/hh_mm_ss.h b/third_party/libcxx/include/c++/v1/__chrono/hh_mm_ss.h
new file mode 100644
index 0000000..746eba9
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/hh_mm_ss.h
@@ -0,0 +1,112 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_HH_MM_SS_H
+#define _LIBCPP___CHRONO_HH_MM_SS_H
+
+#include <__chrono/duration.h>
+#include <__chrono/time_point.h>
+#include <__config>
+#include <__type_traits/common_type.h>
+#include <ratio>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+template <class _Duration>
+class hh_mm_ss {
+private:
+ static_assert(__is_duration_v<_Duration>, "template parameter of hh_mm_ss must be a std::chrono::duration");
+ using __CommonType _LIBCPP_NODEBUG = common_type_t<_Duration, chrono::seconds>;
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr uint64_t __pow10(unsigned __exp) {
+ uint64_t __ret = 1;
+ for (unsigned __i = 0; __i < __exp; ++__i)
+ __ret *= 10U;
+ return __ret;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0) {
+ if (__n >= 2 && __d != 0 && __w < 19)
+ return 1 + __width(__n, __d % __n * 10, __w + 1);
+ return 0;
+ }
+
+public:
+ _LIBCPP_HIDE_FROM_ABI static unsigned constexpr fractional_width =
+ __width(__CommonType::period::den) < 19 ? __width(__CommonType::period::den) : 6u;
+ using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept
+ : __is_neg_(__d < _Duration(0)),
+ __h_(chrono::duration_cast<chrono::hours>(chrono::abs(__d))),
+ __m_(chrono::duration_cast<chrono::minutes>(chrono::abs(__d) - hours())),
+ __s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())),
+ __f_(chrono::duration_cast<precision>(chrono::abs(__d) - hours() - minutes() - seconds())) {}
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept {
+ auto __dur = __h_ + __m_ + __s_ + __f_;
+ return __is_neg_ ? -__dur : __dur;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator precision() const noexcept { return to_duration(); }
+
+private:
+ bool __is_neg_;
+ chrono::hours __h_;
+ chrono::minutes __m_;
+ chrono::seconds __s_;
+ precision __f_;
+};
+_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss);
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept {
+ return __h >= hours(0) && __h < hours(12);
+}
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept {
+ return __h >= hours(12) && __h < hours(24);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept {
+ if (__h == hours(0))
+ return hours(12);
+ else if (__h <= hours(12))
+ return __h;
+ else
+ return __h - hours(12);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept {
+ if (__is_pm)
+ return __h == hours(12) ? __h : __h + hours(12);
+ else
+ return __h == hours(12) ? hours(0) : __h;
+}
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_HH_MM_SS_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/high_resolution_clock.h b/third_party/libcxx/include/c++/v1/__chrono/high_resolution_clock.h
new file mode 100644
index 0000000..d324c7f
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/high_resolution_clock.h
@@ -0,0 +1,35 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_HIGH_RESOLUTION_CLOCK_H
+#define _LIBCPP___CHRONO_HIGH_RESOLUTION_CLOCK_H
+
+#include <__chrono/steady_clock.h>
+#include <__chrono/system_clock.h>
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+#if _LIBCPP_HAS_MONOTONIC_CLOCK
+typedef steady_clock high_resolution_clock;
+#else
+typedef system_clock high_resolution_clock;
+#endif
+
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___CHRONO_HIGH_RESOLUTION_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/is_clock.h b/third_party/libcxx/include/c++/v1/__chrono/is_clock.h
new file mode 100644
index 0000000..e63b848
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/is_clock.h
@@ -0,0 +1,72 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_IS_CLOCK_H
+#define _LIBCPP___CHRONO_IS_CLOCK_H
+
+#include <__config>
+
+#include <__chrono/duration.h>
+#include <__chrono/time_point.h>
+#include <__concepts/same_as.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_arithmetic.h>
+#include <__type_traits/is_class.h>
+#include <__type_traits/is_union.h>
+#include <ratio>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+// Helper to check that _Tp::time_point has the form time_point<_, typename _Tp::duration>.
+template <class _TimePoint, class _ClockType>
+inline constexpr bool __is_valid_clock_time_point_v = false;
+
+template <class _TimePointClock, class _ClockType>
+inline constexpr bool
+ __is_valid_clock_time_point_v<time_point<_TimePointClock, typename _ClockType::duration>, _ClockType> = true;
+
+// Check if a clock satisfies the Cpp17Clock requirements as defined in [time.clock.req]
+template <class _Tp>
+_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_clock_v = requires {
+ typename _Tp::rep;
+ requires is_arithmetic_v<typename _Tp::rep> || is_class_v<typename _Tp::rep> || is_union_v<typename _Tp::rep>;
+
+ typename _Tp::period;
+ requires __is_ratio_v<typename _Tp::period>;
+
+ typename _Tp::duration;
+ requires same_as<typename _Tp::duration, duration<typename _Tp::rep, typename _Tp::period>>;
+
+ typename _Tp::time_point;
+ requires __is_valid_clock_time_point_v<typename _Tp::time_point, _Tp>;
+
+ _Tp::is_steady;
+ requires same_as<decltype((_Tp::is_steady)), const bool&>;
+
+ _Tp::now();
+ requires same_as<decltype(_Tp::now()), typename _Tp::time_point>;
+};
+
+template <class _Tp>
+struct _LIBCPP_NO_SPECIALIZATIONS is_clock : bool_constant<is_clock_v<_Tp>> {};
+
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER
+#endif // _LIBCPP___CHRONO_IS_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/leap_second.h b/third_party/libcxx/include/c++/v1/__chrono/leap_second.h
new file mode 100644
index 0000000..9e9df6b
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/leap_second.h
@@ -0,0 +1,144 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_LEAP_SECOND_H
+#define _LIBCPP___CHRONO_LEAP_SECOND_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/duration.h>
+# include <__chrono/system_clock.h>
+# include <__chrono/time_point.h>
+# include <__compare/ordering.h>
+# include <__compare/three_way_comparable.h>
+# include <__config>
+# include <__cstddef/size_t.h>
+# include <__functional/hash.h>
+# include <__utility/private_constructor_tag.h>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace chrono {
+
+class leap_second {
+public:
+ [[nodiscard]]
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr leap_second(__private_constructor_tag, sys_seconds __date, seconds __value)
+ : __date_(__date), __value_(__value) {}
+
+ _LIBCPP_HIDE_FROM_ABI leap_second(const leap_second&) = default;
+ _LIBCPP_HIDE_FROM_ABI leap_second& operator=(const leap_second&) = default;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sys_seconds date() const noexcept { return __date_; }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr seconds value() const noexcept { return __value_; }
+
+private:
+ sys_seconds __date_;
+ seconds __value_;
+
+ // The function
+ // template<class Duration>
+ // requires three_way_comparable_with<sys_seconds, sys_time<Duration>>
+ // constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y) noexcept;
+ //
+ // Has constraints that are recursive (LWG4139). The proposed resolution is
+ // to make the funcion a hidden friend. For consistency make this change for
+ // all comparison functions.
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const leap_second& __x, const leap_second& __y) {
+ return __x.date() == __y.date();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>(const leap_second& __x, const leap_second& __y) {
+ return __x.date() <=> __y.date();
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const leap_second& __x, const sys_time<_Duration>& __y) {
+ return __x.date() == __y;
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const leap_second& __x, const sys_time<_Duration>& __y) {
+ return __x.date() < __y;
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const sys_time<_Duration>& __x, const leap_second& __y) {
+ return __x < __y.date();
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const leap_second& __x, const sys_time<_Duration>& __y) {
+ return __y < __x;
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const sys_time<_Duration>& __x, const leap_second& __y) {
+ return __y < __x;
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const leap_second& __x, const sys_time<_Duration>& __y) {
+ return !(__y < __x);
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const sys_time<_Duration>& __x, const leap_second& __y) {
+ return !(__y < __x);
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const leap_second& __x, const sys_time<_Duration>& __y) {
+ return !(__x < __y);
+ }
+
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const sys_time<_Duration>& __x, const leap_second& __y) {
+ return !(__x < __y);
+ }
+
+ template <class _Duration>
+ requires three_way_comparable_with<sys_seconds, sys_time<_Duration>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const leap_second& __x, const sys_time<_Duration>& __y) {
+ return __x.date() <=> __y;
+ }
+};
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::leap_second> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::leap_second& __lp) noexcept {
+ return std::__hash_combine(hash<chrono::sys_seconds>{}(__lp.date()), hash<chrono::seconds>{}(__lp.value()));
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+# endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_LEAP_SECOND_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/literals.h b/third_party/libcxx/include/c++/v1/__chrono/literals.h
new file mode 100644
index 0000000..b26acba
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/literals.h
@@ -0,0 +1,45 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_LITERALS_H
+#define _LIBCPP___CHRONO_LITERALS_H
+
+#include <__chrono/day.h>
+#include <__chrono/year.h>
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+inline namespace literals {
+inline namespace chrono_literals {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept {
+ return chrono::day(static_cast<unsigned>(__d));
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept {
+ return chrono::year(static_cast<int>(__y));
+}
+} // namespace chrono_literals
+} // namespace literals
+
+namespace chrono { // hoist the literals into namespace std::chrono
+using namespace literals::chrono_literals;
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_LITERALS_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/local_info.h b/third_party/libcxx/include/c++/v1/__chrono/local_info.h
new file mode 100644
index 0000000..31cf777
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/local_info.h
@@ -0,0 +1,50 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_LOCAL_INFO_H
+#define _LIBCPP___CHRONO_LOCAL_INFO_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/sys_info.h>
+# include <__config>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace chrono {
+
+struct local_info {
+ static constexpr int unique = 0;
+ static constexpr int nonexistent = 1;
+ static constexpr int ambiguous = 2;
+
+ int result;
+ sys_info first;
+ sys_info second;
+};
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_LOCAL_INFO_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/month.h b/third_party/libcxx/include/c++/v1/__chrono/month.h
new file mode 100644
index 0000000..abf07e8
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/month.h
@@ -0,0 +1,128 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_MONTH_H
+#define _LIBCPP___CHRONO_MONTH_H
+
+#include <__chrono/duration.h>
+#include <__compare/ordering.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class month {
+private:
+ unsigned char __m_;
+
+public:
+ month() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept
+ : __m_(static_cast<unsigned char>(__val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept {
+ *this += months{1};
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept {
+ month __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept {
+ *this -= months{1};
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept {
+ month __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month& __lhs, const month& __rhs) noexcept {
+ return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept {
+ auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
+ auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
+ return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept {
+ auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
+ return months(__dm <= 11 ? __dm : __dm + 12);
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+
+inline constexpr month January{1};
+inline constexpr month February{2};
+inline constexpr month March{3};
+inline constexpr month April{4};
+inline constexpr month May{5};
+inline constexpr month June{6};
+inline constexpr month July{7};
+inline constexpr month August{8};
+inline constexpr month September{9};
+inline constexpr month October{10};
+inline constexpr month November{11};
+inline constexpr month December{12};
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::month> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month& __m) noexcept {
+ return static_cast<unsigned>(__m);
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_MONTH_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/month_weekday.h b/third_party/libcxx/include/c++/v1/__chrono/month_weekday.h
new file mode 100644
index 0000000..f149806
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/month_weekday.h
@@ -0,0 +1,135 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_MONTH_WEEKDAY_H
+#define _LIBCPP___CHRONO_MONTH_WEEKDAY_H
+
+#include <__chrono/month.h>
+#include <__chrono/weekday.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class month_weekday {
+private:
+ chrono::month __m_;
+ chrono::weekday_indexed __wdi_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval,
+ const chrono::weekday_indexed& __wdival) noexcept
+ : __m_{__mval}, __wdi_{__wdival} {}
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept {
+ return __wdi_;
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept {
+ return month_weekday{__lhs, __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(int __lhs, const weekday_indexed& __rhs) noexcept {
+ return month_weekday{month(__lhs), __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept {
+ return month_weekday{__rhs, __lhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
+operator/(const weekday_indexed& __lhs, int __rhs) noexcept {
+ return month_weekday{month(__rhs), __lhs};
+}
+
+class month_weekday_last {
+ chrono::month __m_;
+ chrono::weekday_last __wdl_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval,
+ const chrono::weekday_last& __wdlval) noexcept
+ : __m_{__mval}, __wdl_{__wdlval} {}
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept {
+ return __wdl_;
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(const month& __lhs, const weekday_last& __rhs) noexcept {
+ return month_weekday_last{__lhs, __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(int __lhs, const weekday_last& __rhs) noexcept {
+ return month_weekday_last{month(__lhs), __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(const weekday_last& __lhs, const month& __rhs) noexcept {
+ return month_weekday_last{__rhs, __lhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
+operator/(const weekday_last& __lhs, int __rhs) noexcept {
+ return month_weekday_last{month(__rhs), __lhs};
+}
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::month_weekday> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday& __mw) noexcept {
+ return std::__hash_combine(
+ hash<chrono::month>{}(__mw.month()), hash<chrono::weekday_indexed>{}(__mw.weekday_indexed()));
+ }
+};
+
+template <>
+struct hash<chrono::month_weekday_last> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday_last& __mwl) noexcept {
+ return std::__hash_combine(
+ hash<chrono::month>{}(__mwl.month()), hash<chrono::weekday_last>{}(__mwl.weekday_last()));
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_MONTH_WEEKDAY_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/monthday.h b/third_party/libcxx/include/c++/v1/__chrono/monthday.h
new file mode 100644
index 0000000..443d7ea
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/monthday.h
@@ -0,0 +1,155 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_MONTHDAY_H
+#define _LIBCPP___CHRONO_MONTHDAY_H
+
+#include <__chrono/calendar.h>
+#include <__chrono/day.h>
+#include <__chrono/month.h>
+#include <__compare/ordering.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class month_day {
+private:
+ chrono::month __m_;
+ chrono::day __d_;
+
+public:
+ month_day() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept
+ : __m_{__mval}, __d_{__dval} {}
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool month_day::ok() const noexcept {
+ if (!__m_.ok())
+ return false;
+ const unsigned __dval = static_cast<unsigned>(__d_);
+ if (__dval < 1 || __dval > 31)
+ return false;
+ if (__dval <= 29)
+ return true;
+ // Now we've got either 30 or 31
+ const unsigned __mval = static_cast<unsigned>(__m_);
+ if (__mval == 2)
+ return false;
+ if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11)
+ return __dval == 30;
+ return true;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept {
+ return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept {
+ if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
+ return __c;
+ return __lhs.day() <=> __rhs.day();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day
+operator/(const month& __lhs, const day& __rhs) noexcept {
+ return month_day{__lhs, __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day
+operator/(const day& __lhs, const month& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept {
+ return __lhs / day(__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept {
+ return month(__lhs) / __rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept {
+ return month(__rhs) / __lhs;
+}
+
+class month_day_last {
+private:
+ chrono::month __m_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept : __m_{__val} {}
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
+ return __lhs.month() == __rhs.month();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
+ return __lhs.month() <=> __rhs.month();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept {
+ return month_day_last{__lhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept {
+ return month_day_last{__rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept {
+ return month_day_last{month(__lhs)};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept {
+ return month_day_last{month(__rhs)};
+}
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::month_day> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day& __md) noexcept {
+ return std::__hash_combine(hash<chrono::month>{}(__md.month()), hash<chrono::day>{}(__md.day()));
+ }
+};
+
+template <>
+struct hash<chrono::month_day_last> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day_last& __mdl) noexcept {
+ return hash<chrono::month>{}(__mdl.month());
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_MONTHDAY_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/ostream.h b/third_party/libcxx/include/c++/v1/__chrono/ostream.h
new file mode 100644
index 0000000..7a01b18
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/ostream.h
@@ -0,0 +1,354 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_OSTREAM_H
+#define _LIBCPP___CHRONO_OSTREAM_H
+
+#include <__config>
+
+#if _LIBCPP_HAS_LOCALIZATION
+
+# include <__chrono/calendar.h>
+# include <__chrono/day.h>
+# include <__chrono/duration.h>
+# include <__chrono/file_clock.h>
+# include <__chrono/gps_clock.h>
+# include <__chrono/hh_mm_ss.h>
+# include <__chrono/local_info.h>
+# include <__chrono/month.h>
+# include <__chrono/month_weekday.h>
+# include <__chrono/monthday.h>
+# include <__chrono/statically_widen.h>
+# include <__chrono/sys_info.h>
+# include <__chrono/system_clock.h>
+# include <__chrono/tai_clock.h>
+# include <__chrono/utc_clock.h>
+# include <__chrono/weekday.h>
+# include <__chrono/year.h>
+# include <__chrono/year_month.h>
+# include <__chrono/year_month_day.h>
+# include <__chrono/year_month_weekday.h>
+# include <__chrono/zoned_time.h>
+# include <__concepts/same_as.h>
+# include <__format/format_functions.h>
+# include <__fwd/ostream.h>
+# include <ratio>
+# include <sstream>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace chrono {
+
+template <class _CharT, class _Traits, class _Duration>
+ requires(!treat_as_floating_point_v<typename _Duration::rep> && _Duration{1} < days{1})
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_time<_Duration>& __tp) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_days& __dp) {
+ return __os << year_month_day{__dp};
+}
+
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+template <class _CharT, class _Traits, class _Duration>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const utc_time<_Duration>& __tp) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
+}
+
+template <class _CharT, class _Traits, class _Duration>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const tai_time<_Duration>& __tp) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
+}
+
+template <class _CharT, class _Traits, class _Duration>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const gps_time<_Duration>& __tp) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
+}
+
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+
+template <class _CharT, class _Traits, class _Duration>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const file_time<_Duration> __tp) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
+}
+
+template <class _CharT, class _Traits, class _Duration>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const local_time<_Duration> __tp) {
+ return __os << sys_time<_Duration>{__tp.time_since_epoch()};
+}
+
+// Depending on the type the return is a const _CharT* or a basic_string<_CharT>
+template <class _CharT, class _Period>
+_LIBCPP_HIDE_FROM_ABI auto __units_suffix() {
+ // TODO FMT LWG issue the suffixes are always char and not STATICALLY-WIDEN'ed.
+ if constexpr (same_as<typename _Period::type, atto>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "as");
+ else if constexpr (same_as<typename _Period::type, femto>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "fs");
+ else if constexpr (same_as<typename _Period::type, pico>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "ps");
+ else if constexpr (same_as<typename _Period::type, nano>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "ns");
+ else if constexpr (same_as<typename _Period::type, micro>)
+# if _LIBCPP_HAS_UNICODE
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "\u00b5s");
+# else
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "us");
+# endif
+ else if constexpr (same_as<typename _Period::type, milli>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "ms");
+ else if constexpr (same_as<typename _Period::type, centi>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "cs");
+ else if constexpr (same_as<typename _Period::type, deci>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "ds");
+ else if constexpr (same_as<typename _Period::type, ratio<1>>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "s");
+ else if constexpr (same_as<typename _Period::type, deca>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "das");
+ else if constexpr (same_as<typename _Period::type, hecto>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "hs");
+ else if constexpr (same_as<typename _Period::type, kilo>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "ks");
+ else if constexpr (same_as<typename _Period::type, mega>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ms");
+ else if constexpr (same_as<typename _Period::type, giga>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "Gs");
+ else if constexpr (same_as<typename _Period::type, tera>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ts");
+ else if constexpr (same_as<typename _Period::type, peta>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ps");
+ else if constexpr (same_as<typename _Period::type, exa>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "Es");
+ else if constexpr (same_as<typename _Period::type, ratio<60>>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "min");
+ else if constexpr (same_as<typename _Period::type, ratio<3600>>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "h");
+ else if constexpr (same_as<typename _Period::type, ratio<86400>>)
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "d");
+ else if constexpr (_Period::den == 1)
+ return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "[{}]s"), _Period::num);
+ else
+ return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "[{}/{}]s"), _Period::num, _Period::den);
+}
+
+template <class _CharT, class _Traits, class _Rep, class _Period>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const duration<_Rep, _Period>& __d) {
+ basic_ostringstream<_CharT, _Traits> __s;
+ __s.flags(__os.flags());
+ __s.imbue(__os.getloc());
+ __s.precision(__os.precision());
+ __s << __d.count() << chrono::__units_suffix<_CharT, _Period>();
+ return __os << __s.str();
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const day& __d) {
+ return __os << (__d.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%d}"), __d)
+ // Note this error differs from the wording of the Standard. The
+ // Standard wording doesn't work well on AIX or Windows. There
+ // the formatted day seems to be either modulo 100 or completely
+ // omitted. Judging by the wording this is valid.
+ // TODO FMT Write a paper of file an LWG issue.
+ : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02} is not a valid day"),
+ static_cast<unsigned>(__d)));
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const month& __m) {
+ return __os << (__m.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%b}"), __m)
+ : std::format(__os.getloc(),
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{} is not a valid month"),
+ static_cast<unsigned>(__m))); // TODO FMT Standard mandated locale isn't used.
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const year& __y) {
+ return __os << (__y.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y}"), __y)
+ : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y} is not a valid year"), __y));
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday& __wd) {
+ return __os << (__wd.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%a}"), __wd)
+ : std::format(__os.getloc(), // TODO FMT Standard mandated locale isn't used.
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{} is not a valid weekday"),
+ static_cast<unsigned>(__wd.c_encoding())));
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_indexed& __wdi) {
+ auto __i = __wdi.index();
+ return __os << (__i >= 1 && __i <= 5
+ ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[{}]"), __wdi.weekday(), __i)
+ : std::format(__os.getloc(),
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[{} is not a valid index]"),
+ __wdi.weekday(),
+ __i));
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_last& __wdl) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[last]"), __wdl.weekday());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day& __md) {
+ // TODO FMT The Standard allows 30th of February to be printed.
+ // It would be nice to show an error message instead.
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{}"), __md.month(), __md.day());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day_last& __mdl) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/last"), __mdl.month());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday& __mwd) {
+ return __os << std::format(
+ __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwd.month(), __mwd.weekday_indexed());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday_last& __mwdl) {
+ return __os << std::format(
+ __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwdl.month(), __mwdl.weekday_last());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month& __ym) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ym.year(), __ym.month());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day& __ymd) {
+ return __os << (__ymd.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F}"), __ymd)
+ : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F} is not a valid date"), __ymd));
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day_last& __ymdl) {
+ return __os << std::format(
+ __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ymdl.year(), __ymdl.month_day_last());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday& __ymwd) {
+ return __os << std::format(
+ __os.getloc(),
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}/{:L}"),
+ __ymwd.year(),
+ __ymwd.month(),
+ __ymwd.weekday_indexed());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday_last& __ymwdl) {
+ return __os << std::format(
+ __os.getloc(),
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}/{:L}"),
+ __ymwdl.year(),
+ __ymwdl.month(),
+ __ymwdl.weekday_last());
+}
+
+template <class _CharT, class _Traits, class _Duration>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const hh_mm_ss<_Duration> __hms) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%T}"), __hms);
+}
+
+# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_info& __info) {
+ // __info.abbrev is always std::basic_string<char>.
+ // Since these strings typically are short the conversion should be cheap.
+ std::basic_string<_CharT> __abbrev{__info.abbrev.begin(), __info.abbrev.end()};
+ return __os << std::format(
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "[{:%F %T}, {:%F %T}) {:%T} {:%Q%q} \"{}\""),
+ __info.begin,
+ __info.end,
+ hh_mm_ss{__info.offset},
+ __info.save,
+ __abbrev);
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const local_info& __info) {
+ auto __result = [&]() -> basic_string<_CharT> {
+ switch (__info.result) {
+ case local_info::unique:
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "unique");
+ case local_info::nonexistent:
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "non-existent");
+ case local_info::ambiguous:
+ return _LIBCPP_STATICALLY_WIDEN(_CharT, "ambiguous");
+
+ default:
+ return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "unspecified result ({})"), __info.result);
+ };
+ };
+
+ return __os << std::format(
+ _LIBCPP_STATICALLY_WIDEN(_CharT, "{}: {{{}, {}}}"), __result(), __info.first, __info.second);
+}
+
+# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
+template <class _CharT, class _Traits, class _Duration, class _TimeZonePtr>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const zoned_time<_Duration, _TimeZonePtr>& __tp) {
+ return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T %Z}"), __tp);
+}
+# endif
+# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+} // namespace chrono
+
+# endif // if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_LOCALIZATION
+
+#endif // _LIBCPP___CHRONO_OSTREAM_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/parser_std_format_spec.h b/third_party/libcxx/include/c++/v1/__chrono/parser_std_format_spec.h
new file mode 100644
index 0000000..8ecc19f
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/parser_std_format_spec.h
@@ -0,0 +1,421 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H
+#define _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H
+
+#include <__config>
+
+#if _LIBCPP_HAS_LOCALIZATION
+
+# include <__format/concepts.h>
+# include <__format/format_error.h>
+# include <__format/format_parse_context.h>
+# include <__format/formatter_string.h>
+# include <__format/parser_std_format_spec.h>
+# include <string_view>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace __format_spec {
+
+// By not placing this constant in the formatter class it's not duplicated for char and wchar_t
+inline constexpr __fields __fields_chrono_fractional{
+ .__precision_ = true, .__locale_specific_form_ = true, .__type_ = false};
+inline constexpr __fields __fields_chrono{.__locale_specific_form_ = true, .__type_ = false};
+
+/// Flags available or required in a chrono type.
+///
+/// The caller of the chrono formatter lists the types it has available and the
+/// validation tests whether the requested type spec (e.g. %M) is available in
+/// the formatter.
+/// When the type in the chrono-format-spec isn't present in the data a
+/// \ref format_error is thrown.
+enum class __flags {
+ __second = 0x1,
+ __minute = 0x2,
+ __hour = 0x4,
+ __time = __hour | __minute | __second,
+
+ __day = 0x8,
+ __month = 0x10,
+ __year = 0x20,
+
+ __weekday = 0x40,
+
+ __month_day = __day | __month,
+ __month_weekday = __weekday | __month,
+ __year_month = __month | __year,
+ __date = __day | __month | __year | __weekday,
+
+ __date_time = __date | __time,
+
+ __duration = 0x80 | __time,
+
+ __time_zone = 0x100,
+
+ __clock = __date_time | __time_zone
+};
+
+_LIBCPP_HIDE_FROM_ABI constexpr __flags operator&(__flags __lhs, __flags __rhs) {
+ return static_cast<__flags>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_second(__flags __flags) {
+ if ((__flags & __flags::__second) != __flags::__second)
+ std::__throw_format_error("The supplied date time doesn't contain a second");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_minute(__flags __flags) {
+ if ((__flags & __flags::__minute) != __flags::__minute)
+ std::__throw_format_error("The supplied date time doesn't contain a minute");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_hour(__flags __flags) {
+ if ((__flags & __flags::__hour) != __flags::__hour)
+ std::__throw_format_error("The supplied date time doesn't contain an hour");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_time(__flags __flags) {
+ if ((__flags & __flags::__time) != __flags::__time)
+ std::__throw_format_error("The supplied date time doesn't contain a time");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_day(__flags __flags) {
+ if ((__flags & __flags::__day) != __flags::__day)
+ std::__throw_format_error("The supplied date time doesn't contain a day");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_month(__flags __flags) {
+ if ((__flags & __flags::__month) != __flags::__month)
+ std::__throw_format_error("The supplied date time doesn't contain a month");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_year(__flags __flags) {
+ if ((__flags & __flags::__year) != __flags::__year)
+ std::__throw_format_error("The supplied date time doesn't contain a year");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_date(__flags __flags) {
+ if ((__flags & __flags::__date) != __flags::__date)
+ std::__throw_format_error("The supplied date time doesn't contain a date");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_date_or_duration(__flags __flags) {
+ if (((__flags & __flags::__date) != __flags::__date) && ((__flags & __flags::__duration) != __flags::__duration))
+ std::__throw_format_error("The supplied date time doesn't contain a date or duration");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_date_time(__flags __flags) {
+ if ((__flags & __flags::__date_time) != __flags::__date_time)
+ std::__throw_format_error("The supplied date time doesn't contain a date and time");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_weekday(__flags __flags) {
+ if ((__flags & __flags::__weekday) != __flags::__weekday)
+ std::__throw_format_error("The supplied date time doesn't contain a weekday");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_duration(__flags __flags) {
+ if ((__flags & __flags::__duration) != __flags::__duration)
+ std::__throw_format_error("The supplied date time doesn't contain a duration");
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr void __validate_time_zone(__flags __flags) {
+ if ((__flags & __flags::__time_zone) != __flags::__time_zone)
+ std::__throw_format_error("The supplied date time doesn't contain a time zone");
+}
+
+template <class _CharT>
+class __parser_chrono {
+ using _ConstIterator _LIBCPP_NODEBUG = typename basic_format_parse_context<_CharT>::const_iterator;
+
+public:
+ template <class _ParseContext>
+ _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator
+ __parse(_ParseContext& __ctx, __fields __fields, __flags __flags) {
+ _ConstIterator __begin = __parser_.__parse(__ctx, __fields);
+ _ConstIterator __end = __ctx.end();
+ if (__begin == __end)
+ return __begin;
+
+ _ConstIterator __last = __parse_chrono_specs(__begin, __end, __flags);
+ __chrono_specs_ = basic_string_view<_CharT>{__begin, __last};
+
+ return __last;
+ }
+
+ __parser<_CharT> __parser_;
+ basic_string_view<_CharT> __chrono_specs_;
+
+private:
+ _LIBCPP_HIDE_FROM_ABI constexpr _ConstIterator
+ __parse_chrono_specs(_ConstIterator __begin, _ConstIterator __end, __flags __flags) {
+ _LIBCPP_ASSERT_INTERNAL(__begin != __end,
+ "When called with an empty input the function will cause "
+ "undefined behavior by evaluating data not in the input");
+
+ if (*__begin != _CharT('%') && *__begin != _CharT('}'))
+ std::__throw_format_error("The format specifier expects a '%' or a '}'");
+
+ do {
+ switch (*__begin) {
+ case _CharT('{'):
+ std::__throw_format_error("The chrono specifiers contain a '{'");
+
+ case _CharT('}'):
+ return __begin;
+
+ case _CharT('%'):
+ __parse_conversion_spec(__begin, __end, __flags);
+ [[fallthrough]];
+
+ default:
+ // All other literals
+ ++__begin;
+ }
+
+ } while (__begin != __end && *__begin != _CharT('}'));
+
+ return __begin;
+ }
+
+ /// \pre *__begin == '%'
+ /// \post __begin points at the end parsed conversion-spec
+ _LIBCPP_HIDE_FROM_ABI constexpr void
+ __parse_conversion_spec(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) {
+ ++__begin;
+ if (__begin == __end)
+ std::__throw_format_error("End of input while parsing a conversion specifier");
+
+ switch (*__begin) {
+ case _CharT('n'):
+ case _CharT('t'):
+ case _CharT('%'):
+ break;
+
+ case _CharT('S'):
+ __format_spec::__validate_second(__flags);
+ break;
+
+ case _CharT('M'):
+ __format_spec::__validate_minute(__flags);
+ break;
+
+ case _CharT('p'): // TODO FMT does the formater require an hour or a time?
+ case _CharT('H'):
+ case _CharT('I'):
+ __parser_.__hour_ = true;
+ __validate_hour(__flags);
+ break;
+
+ case _CharT('r'):
+ case _CharT('R'):
+ case _CharT('T'):
+ case _CharT('X'):
+ __parser_.__hour_ = true;
+ __format_spec::__validate_time(__flags);
+ break;
+
+ case _CharT('d'):
+ case _CharT('e'):
+ __format_spec::__validate_day(__flags);
+ break;
+
+ case _CharT('b'):
+ case _CharT('h'):
+ case _CharT('B'):
+ __parser_.__month_name_ = true;
+ [[fallthrough]];
+ case _CharT('m'):
+ __format_spec::__validate_month(__flags);
+ break;
+
+ case _CharT('y'):
+ case _CharT('C'):
+ case _CharT('Y'):
+ __format_spec::__validate_year(__flags);
+ break;
+
+ case _CharT('j'):
+ __parser_.__day_of_year_ = true;
+ __format_spec::__validate_date_or_duration(__flags);
+ break;
+
+ case _CharT('g'):
+ case _CharT('G'):
+ case _CharT('U'):
+ case _CharT('V'):
+ case _CharT('W'):
+ __parser_.__week_of_year_ = true;
+ [[fallthrough]];
+ case _CharT('x'):
+ case _CharT('D'):
+ case _CharT('F'):
+ __format_spec::__validate_date(__flags);
+ break;
+
+ case _CharT('c'):
+ __format_spec::__validate_date_time(__flags);
+ break;
+
+ case _CharT('a'):
+ case _CharT('A'):
+ __parser_.__weekday_name_ = true;
+ [[fallthrough]];
+ case _CharT('u'):
+ case _CharT('w'):
+ __parser_.__weekday_ = true;
+ __validate_weekday(__flags);
+ __format_spec::__validate_weekday(__flags);
+ break;
+
+ case _CharT('q'):
+ case _CharT('Q'):
+ __format_spec::__validate_duration(__flags);
+ break;
+
+ case _CharT('E'):
+ __parse_modifier_E(__begin, __end, __flags);
+ break;
+
+ case _CharT('O'):
+ __parse_modifier_O(__begin, __end, __flags);
+ break;
+
+ case _CharT('z'):
+ case _CharT('Z'):
+ // Currently there's no time zone information. However some clocks have a
+ // hard-coded "time zone", for these clocks the information can be used.
+ // TODO FMT implement time zones.
+ __format_spec::__validate_time_zone(__flags);
+ break;
+
+ default: // unknown type;
+ std::__throw_format_error("The date time type specifier is invalid");
+ }
+ }
+
+ /// \pre *__begin == 'E'
+ /// \post __begin is incremented by one.
+ _LIBCPP_HIDE_FROM_ABI constexpr void
+ __parse_modifier_E(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) {
+ ++__begin;
+ if (__begin == __end)
+ std::__throw_format_error("End of input while parsing the modifier E");
+
+ switch (*__begin) {
+ case _CharT('X'):
+ __parser_.__hour_ = true;
+ __format_spec::__validate_time(__flags);
+ break;
+
+ case _CharT('y'):
+ case _CharT('C'):
+ case _CharT('Y'):
+ __format_spec::__validate_year(__flags);
+ break;
+
+ case _CharT('x'):
+ __format_spec::__validate_date(__flags);
+ break;
+
+ case _CharT('c'):
+ __format_spec::__validate_date_time(__flags);
+ break;
+
+ case _CharT('z'):
+ // Currently there's no time zone information. However some clocks have a
+ // hard-coded "time zone", for these clocks the information can be used.
+ // TODO FMT implement time zones.
+ __format_spec::__validate_time_zone(__flags);
+ break;
+
+ default:
+ std::__throw_format_error("The date time type specifier for modifier E is invalid");
+ }
+ }
+
+ /// \pre *__begin == 'O'
+ /// \post __begin is incremented by one.
+ _LIBCPP_HIDE_FROM_ABI constexpr void
+ __parse_modifier_O(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) {
+ ++__begin;
+ if (__begin == __end)
+ std::__throw_format_error("End of input while parsing the modifier O");
+
+ switch (*__begin) {
+ case _CharT('S'):
+ __format_spec::__validate_second(__flags);
+ break;
+
+ case _CharT('M'):
+ __format_spec::__validate_minute(__flags);
+ break;
+
+ case _CharT('I'):
+ case _CharT('H'):
+ __parser_.__hour_ = true;
+ __format_spec::__validate_hour(__flags);
+ break;
+
+ case _CharT('d'):
+ case _CharT('e'):
+ __format_spec::__validate_day(__flags);
+ break;
+
+ case _CharT('m'):
+ __format_spec::__validate_month(__flags);
+ break;
+
+ case _CharT('y'):
+ __format_spec::__validate_year(__flags);
+ break;
+
+ case _CharT('U'):
+ case _CharT('V'):
+ case _CharT('W'):
+ __parser_.__week_of_year_ = true;
+ __format_spec::__validate_date(__flags);
+ break;
+
+ case _CharT('u'):
+ case _CharT('w'):
+ __parser_.__weekday_ = true;
+ __format_spec::__validate_weekday(__flags);
+ break;
+
+ case _CharT('z'):
+ // Currently there's no time zone information. However some clocks have a
+ // hard-coded "time zone", for these clocks the information can be used.
+ // TODO FMT implement time zones.
+ __format_spec::__validate_time_zone(__flags);
+ break;
+
+ default:
+ std::__throw_format_error("The date time type specifier for modifier O is invalid");
+ }
+ }
+};
+
+} // namespace __format_spec
+
+# endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_LOCALIZATION
+
+#endif // _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/statically_widen.h b/third_party/libcxx/include/c++/v1/__chrono/statically_widen.h
new file mode 100644
index 0000000..40e0856
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/statically_widen.h
@@ -0,0 +1,52 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_STATICALLY_WIDEN_H
+#define _LIBCPP___CHRONO_STATICALLY_WIDEN_H
+
+// Implements the STATICALLY-WIDEN exposition-only function. ([time.general]/2)
+
+#include <__concepts/same_as.h>
+#include <__config>
+#include <__format/concepts.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 20
+
+# if _LIBCPP_HAS_WIDE_CHARACTERS
+template <__fmt_char_type _CharT>
+_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) {
+ if constexpr (same_as<_CharT, char>)
+ return __str;
+ else
+ return __wstr;
+}
+# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str)
+# else // _LIBCPP_HAS_WIDE_CHARACTERS
+
+// Without this indirection the unit test test/libcxx/modules_include.sh.cpp
+// fails for the CI build "No wide characters". This seems like a bug.
+// TODO FMT investigate why this is needed.
+template <__fmt_char_type _CharT>
+_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str) {
+ return __str;
+}
+# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str)
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
+
+#endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___CHRONO_STATICALLY_WIDEN_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/steady_clock.h b/third_party/libcxx/include/c++/v1/__chrono/steady_clock.h
new file mode 100644
index 0000000..8e68c9a
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/steady_clock.h
@@ -0,0 +1,42 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_STEADY_CLOCK_H
+#define _LIBCPP___CHRONO_STEADY_CLOCK_H
+
+#include <__chrono/duration.h>
+#include <__chrono/time_point.h>
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+#if _LIBCPP_HAS_MONOTONIC_CLOCK
+class _LIBCPP_EXPORTED_FROM_ABI steady_clock {
+public:
+ typedef nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<steady_clock, duration> time_point;
+ static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = true;
+
+ [[__nodiscard__]] static time_point now() _NOEXCEPT;
+};
+#endif
+
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___CHRONO_STEADY_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/sys_info.h b/third_party/libcxx/include/c++/v1/__chrono/sys_info.h
new file mode 100644
index 0000000..81e37f2
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/sys_info.h
@@ -0,0 +1,51 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_SYS_INFO_H
+#define _LIBCPP___CHRONO_SYS_INFO_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/duration.h>
+# include <__chrono/system_clock.h>
+# include <__chrono/time_point.h>
+# include <__config>
+# include <string>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace chrono {
+
+struct sys_info {
+ sys_seconds begin;
+ sys_seconds end;
+ seconds offset;
+ minutes save;
+ string abbrev;
+};
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_SYS_INFO_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/system_clock.h b/third_party/libcxx/include/c++/v1/__chrono/system_clock.h
new file mode 100644
index 0000000..e3ef75a
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/system_clock.h
@@ -0,0 +1,52 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_SYSTEM_CLOCK_H
+#define _LIBCPP___CHRONO_SYSTEM_CLOCK_H
+
+#include <__chrono/duration.h>
+#include <__chrono/time_point.h>
+#include <__config>
+#include <ctime>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class _LIBCPP_EXPORTED_FROM_ABI system_clock {
+public:
+ typedef microseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<system_clock> time_point;
+ static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
+
+ [[__nodiscard__]] static time_point now() _NOEXCEPT;
+ [[__nodiscard__]] static time_t to_time_t(const time_point& __t) _NOEXCEPT;
+ [[__nodiscard__]] static time_point from_time_t(time_t __t) _NOEXCEPT;
+};
+
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Duration>
+using sys_time = time_point<system_clock, _Duration>;
+using sys_seconds = sys_time<seconds>;
+using sys_days = sys_time<days>;
+
+#endif
+
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___CHRONO_SYSTEM_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/tai_clock.h b/third_party/libcxx/include/c++/v1/__chrono/tai_clock.h
new file mode 100644
index 0000000..14c8b70
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/tai_clock.h
@@ -0,0 +1,108 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_TAI_CLOCK_H
+#define _LIBCPP___CHRONO_TAI_CLOCK_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__assert>
+# include <__chrono/duration.h>
+# include <__chrono/time_point.h>
+# include <__chrono/utc_clock.h>
+# include <__config>
+# include <__type_traits/common_type.h>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_PUSH_MACROS
+# include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+class tai_clock;
+
+template <class _Duration>
+using tai_time = time_point<tai_clock, _Duration>;
+using tai_seconds = tai_time<seconds>;
+
+// [time.clock.tai.overview]/1
+// The clock tai_clock measures seconds since 1958-01-01 00:00:00 and is
+// offset 10s ahead of UTC at this date. That is, 1958-01-01 00:00:00 TAI is
+// equivalent to 1957-12-31 23:59:50 UTC. Leap seconds are not inserted into
+// TAI. Therefore every time a leap second is inserted into UTC, UTC shifts
+// another second with respect to TAI. For example by 2000-01-01 there had
+// been 22 positive and 0 negative leap seconds inserted so 2000-01-01
+// 00:00:00 UTC is equivalent to 2000-01-01 00:00:32 TAI (22s plus the
+// initial 10s offset).
+//
+// Note this does not specify what the UTC offset before 1958-01-01 00:00:00
+// TAI is, nor does it follow the "real" TAI clock between 1958-01-01 and the
+// start of the UTC epoch. So while the member functions are fully specified in
+// the standard, they do not technically follow the "real-world" TAI clock with
+// 100% accuracy.
+//
+// https://koka-lang.github.io/koka/doc/std_time_utc.html contains more
+// information and references.
+class tai_clock {
+public:
+ using rep = utc_clock::rep;
+ using period = utc_clock::period;
+ using duration = chrono::duration<rep, period>;
+ using time_point = chrono::time_point<tai_clock>;
+ static constexpr bool is_steady = false; // The utc_clock is not steady.
+
+ // The static difference between UTC and TAI time.
+ static constexpr chrono::seconds __offset{378691210};
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static time_point now() { return from_utc(utc_clock::now()); }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static utc_time<common_type_t<_Duration, seconds>>
+ to_utc(const tai_time<_Duration>& __time) noexcept {
+ using _Rp = common_type_t<_Duration, seconds>;
+ _Duration __time_since_epoch = __time.time_since_epoch();
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__time_since_epoch >= utc_time<_Rp>::min().time_since_epoch() + __offset,
+ "the TAI to UTC conversion would underflow");
+
+ return utc_time<_Rp>{__time_since_epoch - __offset};
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static tai_time<common_type_t<_Duration, seconds>>
+ from_utc(const utc_time<_Duration>& __time) noexcept {
+ using _Rp = common_type_t<_Duration, seconds>;
+ _Duration __time_since_epoch = __time.time_since_epoch();
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__time_since_epoch <= utc_time<_Rp>::max().time_since_epoch() - __offset,
+ "the UTC to TAI conversion would overflow");
+
+ return tai_time<_Rp>{__time_since_epoch + __offset};
+ }
+};
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_TAI_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/time_point.h b/third_party/libcxx/include/c++/v1/__chrono/time_point.h
new file mode 100644
index 0000000..d393e34
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/time_point.h
@@ -0,0 +1,255 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_TIME_POINT_H
+#define _LIBCPP___CHRONO_TIME_POINT_H
+
+#include <__chrono/duration.h>
+#include <__compare/ordering.h>
+#include <__compare/three_way_comparable.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+#include <__type_traits/common_type.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_convertible.h>
+#include <limits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+template <class _Clock, class _Duration = typename _Clock::duration>
+class time_point {
+ static_assert(__is_duration_v<_Duration>, "Second template parameter of time_point must be a std::chrono::duration");
+
+public:
+ typedef _Clock clock;
+ typedef _Duration duration;
+ typedef typename duration::rep rep;
+ typedef typename duration::period period;
+
+private:
+ duration __d_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point() : __d_(duration::zero()) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit time_point(const duration& __d) : __d_(__d) {}
+
+ // conversions
+ template <class _Duration2, __enable_if_t<is_convertible<_Duration2, duration>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point(const time_point<clock, _Duration2>& __t)
+ : __d_(__t.time_since_epoch()) {}
+
+ // observer
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 duration time_since_epoch() const {
+ return __d_;
+ }
+
+ // arithmetic
+
+#if _LIBCPP_STD_VER >= 20
+ _LIBCPP_HIDE_FROM_ABI constexpr time_point& operator++() {
+ ++__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr time_point operator++(int) { return time_point{__d_++}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr time_point& operator--() {
+ --__d_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr time_point operator--(int) { return time_point{__d_--}; }
+#endif // _LIBCPP_STD_VER >= 20
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator+=(const duration& __d) {
+ __d_ += __d;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 time_point& operator-=(const duration& __d) {
+ __d_ -= __d;
+ return *this;
+ }
+
+ // special values
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point min() _NOEXCEPT {
+ return time_point(duration::min());
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT {
+ return time_point(duration::max());
+ }
+};
+
+} // namespace chrono
+
+template <class _Clock, class _Duration1, class _Duration2>
+struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> > {
+ typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
+};
+
+namespace chrono {
+
+template <class _ToDuration, class _Clock, class _Duration, __enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, _ToDuration>
+time_point_cast(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
+}
+
+#if _LIBCPP_STD_VER >= 17
+template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[nodiscard]] inline
+ _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> floor(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
+}
+
+template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration>
+ceil(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
+}
+
+template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration_v<_ToDuration>, int> = 0>
+[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration>
+round(const time_point<_Clock, _Duration>& __t) {
+ return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
+}
+
+template <class _Rep, class _Period, enable_if_t<numeric_limits<_Rep>::is_signed, int> = 0>
+[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) {
+ return __d >= __d.zero() ? +__d : -__d;
+}
+#endif // _LIBCPP_STD_VER >= 17
+
+// time_point ==
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() == __rhs.time_since_epoch();
+}
+
+#if _LIBCPP_STD_VER <= 17
+
+// time_point !=
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__lhs == __rhs);
+}
+
+#endif // _LIBCPP_STD_VER <= 17
+
+// time_point <
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() < __rhs.time_since_epoch();
+}
+
+// time_point >
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __rhs < __lhs;
+}
+
+// time_point <=
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__rhs < __lhs);
+}
+
+// time_point >=
+
+template <class _Clock, class _Duration1, class _Duration2>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return !(__lhs < __rhs);
+}
+
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Clock, class _Duration1, three_way_comparable_with<_Duration1> _Duration2>
+_LIBCPP_HIDE_FROM_ABI constexpr auto
+operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() <=> __rhs.time_since_epoch();
+}
+
+#endif // _LIBCPP_STD_VER >= 20
+
+// time_point operator+(time_point x, duration y);
+
+template <class _Clock, class _Duration1, class _Rep2, class _Period2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
+ return _Tr(__lhs.time_since_epoch() + __rhs);
+}
+
+// time_point operator+(duration x, time_point y);
+
+template <class _Rep1, class _Period1, class _Clock, class _Duration2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
+operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __rhs + __lhs;
+}
+
+// time_point operator-(time_point x, duration y);
+
+template <class _Clock, class _Duration1, class _Rep2, class _Period2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+ typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret;
+ return _Ret(__lhs.time_since_epoch() - __rhs);
+}
+
+// duration operator-(time_point x, time_point y);
+
+template <class _Clock, class _Duration1, class _Duration2>
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
+typename common_type<_Duration1, _Duration2>::type
+operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+ return __lhs.time_since_epoch() - __rhs.time_since_epoch();
+}
+
+} // namespace chrono
+
+#if _LIBCPP_STD_VER >= 26
+
+template <class _Clock, class _Duration>
+ requires __has_enabled_hash<_Duration>::value
+struct hash<chrono::time_point<_Clock, _Duration>> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::time_point<_Clock, _Duration>& __tp) {
+ return hash<_Duration>{}(__tp.time_since_epoch());
+ }
+};
+
+#endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___CHRONO_TIME_POINT_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/time_zone.h b/third_party/libcxx/include/c++/v1/__chrono/time_zone.h
new file mode 100644
index 0000000..d18d59d
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/time_zone.h
@@ -0,0 +1,185 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_TIME_ZONE_H
+#define _LIBCPP___CHRONO_TIME_ZONE_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/calendar.h>
+# include <__chrono/duration.h>
+# include <__chrono/exception.h>
+# include <__chrono/local_info.h>
+# include <__chrono/sys_info.h>
+# include <__chrono/system_clock.h>
+# include <__compare/strong_order.h>
+# include <__config>
+# include <__memory/unique_ptr.h>
+# include <__type_traits/common_type.h>
+# include <string_view>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_PUSH_MACROS
+# include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+enum class choose { earliest, latest };
+
+class _LIBCPP_AVAILABILITY_TZDB time_zone {
+ _LIBCPP_HIDE_FROM_ABI time_zone() = default;
+
+public:
+ class __impl; // public so it can be used by make_unique.
+
+ // The "constructor".
+ //
+ // The default constructor is private to avoid the constructor from being
+ // part of the ABI. Instead use an __ugly_named function as an ABI interface,
+ // since that gives us the ability to change it in the future.
+ [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI static time_zone __create(unique_ptr<__impl>&& __p);
+
+ _LIBCPP_EXPORTED_FROM_ABI ~time_zone();
+
+ _LIBCPP_HIDE_FROM_ABI time_zone(time_zone&&) = default;
+ _LIBCPP_HIDE_FROM_ABI time_zone& operator=(time_zone&&) = default;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_view name() const noexcept { return __name(); }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_info get_info(const sys_time<_Duration>& __time) const {
+ return __get_info(chrono::time_point_cast<seconds>(__time));
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_info get_info(const local_time<_Duration>& __time) const {
+ return __get_info(chrono::time_point_cast<seconds>(__time));
+ }
+
+ // We don't apply nodiscard here since this function throws on many inputs,
+ // so it could be used as a validation.
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>> to_sys(const local_time<_Duration>& __time) const {
+ local_info __info = get_info(__time);
+ switch (__info.result) {
+ case local_info::unique:
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
+
+ case local_info::nonexistent:
+ chrono::__throw_nonexistent_local_time(__time, __info);
+
+ case local_info::ambiguous:
+ chrono::__throw_ambiguous_local_time(__time, __info);
+ }
+
+ // TODO TZDB The Standard does not specify anything in these cases.
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
+
+ return {};
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>>
+ to_sys(const local_time<_Duration>& __time, choose __z) const {
+ local_info __info = get_info(__time);
+ switch (__info.result) {
+ case local_info::unique: // first and second are the same
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
+
+ case local_info::nonexistent:
+ // first and second are the same
+ // All non-existing values are converted to the same time.
+ return sys_time<common_type_t<_Duration, seconds>>{__info.first.end};
+
+ case local_info::ambiguous:
+ switch (__z) {
+ case choose::earliest:
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
+
+ case choose::latest:
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.second.offset};
+
+ // Note a value out of bounds is not specified.
+ }
+ }
+
+ // TODO TZDB The standard does not specify anything in these cases.
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
+
+ return {};
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_time<common_type_t<_Duration, seconds>>
+ to_local(const sys_time<_Duration>& __time) const {
+ using _Dp = common_type_t<_Duration, seconds>;
+
+ sys_info __info = get_info(__time);
+
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.offset >= chrono::seconds{0} || __time.time_since_epoch() >= _Dp::min() - __info.offset,
+ "cannot convert the system time; it would be before the minimum local clock value");
+
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.offset <= chrono::seconds{0} || __time.time_since_epoch() <= _Dp::max() - __info.offset,
+ "cannot convert the system time; it would be after the maximum local clock value");
+
+ return local_time<_Dp>{__time.time_since_epoch() + __info.offset};
+ }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; }
+
+private:
+ [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI string_view __name() const noexcept;
+
+ [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI sys_info __get_info(sys_seconds __time) const;
+ [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI local_info __get_info(local_seconds __time) const;
+
+ unique_ptr<__impl> __impl_;
+};
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline bool
+operator==(const time_zone& __x, const time_zone& __y) noexcept {
+ return __x.name() == __y.name();
+}
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline strong_ordering
+operator<=>(const time_zone& __x, const time_zone& __y) noexcept {
+ return __x.name() <=> __y.name();
+}
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_TIME_ZONE_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/time_zone_link.h b/third_party/libcxx/include/c++/v1/__chrono/time_zone_link.h
new file mode 100644
index 0000000..cae40b0
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/time_zone_link.h
@@ -0,0 +1,79 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_TIME_ZONE_LINK_H
+#define _LIBCPP___CHRONO_TIME_ZONE_LINK_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__compare/strong_order.h>
+# include <__config>
+# include <__utility/private_constructor_tag.h>
+# include <string>
+# include <string_view>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_PUSH_MACROS
+# include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+class time_zone_link {
+public:
+ [[nodiscard]]
+ _LIBCPP_HIDE_FROM_ABI explicit time_zone_link(__private_constructor_tag, string_view __name, string_view __target)
+ : __name_{__name}, __target_{__target} {}
+
+ _LIBCPP_HIDE_FROM_ABI time_zone_link(time_zone_link&&) = default;
+ _LIBCPP_HIDE_FROM_ABI time_zone_link& operator=(time_zone_link&&) = default;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_view name() const noexcept { return __name_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_view target() const noexcept { return __target_; }
+
+private:
+ string __name_;
+ // TODO TZDB instead of the name we can store the pointer to a zone. These
+ // pointers are immutable. This makes it possible to directly return a
+ // pointer in the time_zone in the 'locate_zone' function.
+ string __target_;
+};
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline bool
+operator==(const time_zone_link& __x, const time_zone_link& __y) noexcept {
+ return __x.name() == __y.name();
+}
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline strong_ordering
+operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept {
+ return __x.name() <=> __y.name();
+}
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_TIME_ZONE_LINK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/tzdb.h b/third_party/libcxx/include/c++/v1/__chrono/tzdb.h
new file mode 100644
index 0000000..fb85f66
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/tzdb.h
@@ -0,0 +1,96 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_TZDB_H
+#define _LIBCPP___CHRONO_TZDB_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__algorithm/ranges_lower_bound.h>
+# include <__chrono/leap_second.h>
+# include <__chrono/time_zone.h>
+# include <__chrono/time_zone_link.h>
+# include <__config>
+# include <__memory/addressof.h>
+# include <__vector/vector.h>
+# include <stdexcept>
+# include <string>
+# include <string_view>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_PUSH_MACROS
+# include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+struct tzdb {
+ string version;
+ vector<time_zone> zones;
+ vector<time_zone_link> links;
+
+ vector<leap_second> leap_seconds;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const time_zone* __locate_zone(string_view __name) const {
+ if (const time_zone* __result = __find_in_zone(__name))
+ return __result;
+
+ if (auto __it = ranges::lower_bound(links, __name, {}, &time_zone_link::name);
+ __it != links.end() && __it->name() == __name)
+ if (const time_zone* __result = __find_in_zone(__it->target()))
+ return __result;
+
+ return nullptr;
+ }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const time_zone* locate_zone(string_view __name) const {
+ if (const time_zone* __result = __locate_zone(__name))
+ return __result;
+
+ std::__throw_runtime_error("tzdb: requested time zone not found");
+ }
+
+ [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI const time_zone* current_zone() const {
+ return __current_zone();
+ }
+
+private:
+ _LIBCPP_HIDE_FROM_ABI const time_zone* __find_in_zone(string_view __name) const noexcept {
+ if (auto __it = ranges::lower_bound(zones, __name, {}, &time_zone::name);
+ __it != zones.end() && __it->name() == __name)
+ return std::addressof(*__it);
+
+ return nullptr;
+ }
+
+ [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const time_zone* __current_zone() const;
+};
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_TZDB_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/tzdb_list.h b/third_party/libcxx/include/c++/v1/__chrono/tzdb_list.h
new file mode 100644
index 0000000..2b83a6d
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/tzdb_list.h
@@ -0,0 +1,108 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_TZDB_LIST_H
+#define _LIBCPP___CHRONO_TZDB_LIST_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/time_zone.h>
+# include <__chrono/tzdb.h>
+# include <__config>
+# include <__fwd/string.h>
+# include <forward_list>
+# include <string_view>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+// TODO TZDB
+// Libc++ recently switched to only export __ugly_names from the dylib.
+// Since the library is still experimental the functions in this header
+// should be adapted to this new style. The other tzdb headers should be
+// evaluated too.
+
+class _LIBCPP_AVAILABILITY_TZDB tzdb_list {
+public:
+ class __impl; // public to allow construction in dylib
+ _LIBCPP_HIDE_FROM_ABI explicit tzdb_list(__impl* __p) : __impl_(__p) {
+ _LIBCPP_ASSERT_NON_NULL(__impl_ != nullptr, "initialized time_zone without a valid pimpl object");
+ }
+ _LIBCPP_EXPORTED_FROM_ABI ~tzdb_list();
+
+ tzdb_list(const tzdb_list&) = delete;
+ tzdb_list& operator=(const tzdb_list&) = delete;
+
+ using const_iterator = forward_list<tzdb>::const_iterator;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const tzdb& front() const noexcept { return __front(); }
+
+ _LIBCPP_HIDE_FROM_ABI const_iterator erase_after(const_iterator __p) { return __erase_after(__p); }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const noexcept { return __begin(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const noexcept { return __end(); }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const noexcept { return __cbegin(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const noexcept { return __cend(); }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __impl& __implementation() { return *__impl_; }
+
+private:
+ [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const tzdb& __front() const noexcept;
+
+ _LIBCPP_EXPORTED_FROM_ABI const_iterator __erase_after(const_iterator __p);
+
+ [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __begin() const noexcept;
+ [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __end() const noexcept;
+
+ [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __cbegin() const noexcept;
+ [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __cend() const noexcept;
+
+ __impl* __impl_;
+};
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI tzdb_list& get_tzdb_list();
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const tzdb& get_tzdb() {
+ return get_tzdb_list().front();
+}
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* locate_zone(string_view __name) {
+ return get_tzdb().locate_zone(__name);
+}
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* current_zone() {
+ return get_tzdb().current_zone();
+}
+
+_LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb();
+
+[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version();
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_TZDB_LIST_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/utc_clock.h b/third_party/libcxx/include/c++/v1/__chrono/utc_clock.h
new file mode 100644
index 0000000..2207b89
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/utc_clock.h
@@ -0,0 +1,163 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_UTC_CLOCK_H
+#define _LIBCPP___CHRONO_UTC_CLOCK_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/duration.h>
+# include <__chrono/leap_second.h>
+# include <__chrono/system_clock.h>
+# include <__chrono/time_point.h>
+# include <__chrono/tzdb.h>
+# include <__chrono/tzdb_list.h>
+# include <__config>
+# include <__type_traits/common_type.h>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+class utc_clock;
+
+template <class _Duration>
+using utc_time = time_point<utc_clock, _Duration>;
+using utc_seconds = utc_time<seconds>;
+
+class utc_clock {
+public:
+ using rep = system_clock::rep;
+ using period = system_clock::period;
+ using duration = chrono::duration<rep, period>;
+ using time_point = chrono::time_point<utc_clock>;
+ static constexpr bool is_steady = false; // The system_clock is not steady.
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static time_point now() { return from_sys(system_clock::now()); }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static sys_time<common_type_t<_Duration, seconds>>
+ to_sys(const utc_time<_Duration>& __time);
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static utc_time<common_type_t<_Duration, seconds>>
+ from_sys(const sys_time<_Duration>& __time) {
+ using _Rp = utc_time<common_type_t<_Duration, seconds>>;
+ // TODO TZDB investigate optimizations.
+ //
+ // The leap second database stores all transitions, this mean to calculate
+ // the current number of leap seconds the code needs to iterate over all
+ // leap seconds to accumulate the sum. Then the sum can be used to determine
+ // the sys_time. Accessing the database involves acquiring a mutex.
+ //
+ // The historic entries in the database are immutable. Hard-coding these
+ // values in a table would allow:
+ // - To store the sum, allowing a binary search on the data.
+ // - Avoid acquiring a mutex.
+ // The disadvantage are:
+ // - A slightly larger code size.
+ //
+ // There are two optimization directions
+ // - hard-code the database and do a linear search for future entries. This
+ // search can start at the back, and should probably contain very few
+ // entries. (Adding leap seconds is quite rare and new release of libc++
+ // can add the new entries; they are announced half a year before they are
+ // added.)
+ // - During parsing the leap seconds store an additional database in the
+ // dylib with the list of the sum of the leap seconds. In that case there
+ // can be a private function __get_utc_to_sys_table that returns the
+ // table.
+ //
+ // Note for to_sys there are no optimizations to be done; it uses
+ // get_leap_second_info. The function get_leap_second_info could benefit
+ // from optimizations as described above; again both options apply.
+
+ // Both UTC and the system clock use the same epoch. The Standard
+ // specifies from 1970-01-01 even when UTC starts at
+ // 1972-01-01 00:00:10 TAI. So when the sys_time is before epoch we can be
+ // sure there both clocks return the same value.
+
+ const tzdb& __tzdb = chrono::get_tzdb();
+ _Rp __result{__time.time_since_epoch()};
+ for (const auto& __leap_second : __tzdb.leap_seconds) {
+ if (__leap_second > __time)
+ return __result;
+
+ __result += __leap_second.value();
+ }
+ return __result;
+ }
+};
+
+struct leap_second_info {
+ bool is_leap_second;
+ seconds elapsed;
+};
+
+template <class _Duration>
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI leap_second_info get_leap_second_info(const utc_time<_Duration>& __time) {
+ const tzdb& __tzdb = chrono::get_tzdb();
+ if (__tzdb.leap_seconds.empty()) [[unlikely]]
+ return {false, chrono::seconds{0}};
+
+ sys_seconds __sys{chrono::floor<seconds>(__time).time_since_epoch()};
+ seconds __elapsed{0};
+ for (const auto& __leap_second : __tzdb.leap_seconds) {
+ if (__sys == __leap_second.date() + __elapsed)
+ // A time point may only be a leap second during a positive leap second
+ // insertion, since time points that occur during a (theoretical)
+ // negative leap second don't exist.
+ return {__leap_second.value() > 0s, __elapsed + __leap_second.value()};
+
+ if (__sys < __leap_second.date() + __elapsed)
+ return {false, __elapsed};
+
+ __elapsed += __leap_second.value();
+ }
+
+ return {false, __elapsed};
+}
+
+template <class _Duration>
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>>
+utc_clock::to_sys(const utc_time<_Duration>& __time) {
+ using _Dp = common_type_t<_Duration, seconds>;
+ leap_second_info __info = chrono::get_leap_second_info(__time);
+
+ // [time.clock.utc.members]/2
+ // Returns: A sys_time t, such that from_sys(t) == u if such a mapping
+ // exists. Otherwise u represents a time_point during a positive leap
+ // second insertion, the conversion counts that leap second as not
+ // inserted, and the last representable value of sys_time prior to the
+ // insertion of the leap second is returned.
+ sys_time<common_type_t<_Duration, seconds>> __result{__time.time_since_epoch() - __info.elapsed};
+ if (__info.is_leap_second)
+ return chrono::floor<seconds>(__result) + chrono::seconds{1} - _Dp{1};
+
+ return __result;
+}
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_UTC_CLOCK_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/weekday.h b/third_party/libcxx/include/c++/v1/__chrono/weekday.h
new file mode 100644
index 0000000..5e1065d
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/weekday.h
@@ -0,0 +1,202 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_WEEKDAY_H
+#define _LIBCPP___CHRONO_WEEKDAY_H
+
+#include <__chrono/calendar.h>
+#include <__chrono/duration.h>
+#include <__chrono/system_clock.h>
+#include <__chrono/time_point.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class weekday_indexed;
+class weekday_last;
+
+class weekday {
+private:
+ unsigned char __wd_;
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned char __weekday_from_days(int __days) noexcept;
+
+public:
+ weekday() = default;
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept
+ : __wd_(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday(const sys_days& __sysd) noexcept
+ : __wd_(__weekday_from_days(__sysd.time_since_epoch().count())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(const local_days& __locd) noexcept
+ : __wd_(__weekday_from_days(__locd.time_since_epoch().count())) {}
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept {
+ __wd_ = (__wd_ == 6 ? 0 : __wd_ + 1);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator++(int) noexcept {
+ weekday __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept {
+ __wd_ = (__wd_ == 0 ? 6 : __wd_ - 1);
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator--(int) noexcept {
+ weekday __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept;
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept {
+ return __wd_ == 0u ? 7 : __wd_;
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
+};
+
+// https://howardhinnant.github.io/date_algorithms.html#weekday_from_days
+_LIBCPP_HIDE_FROM_ABI inline constexpr unsigned char weekday::__weekday_from_days(int __days) noexcept {
+ return static_cast<unsigned char>(static_cast<unsigned>(__days >= -4 ? (__days + 4) % 7 : (__days + 5) % 7 + 6));
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept {
+ return __lhs.c_encoding() == __rhs.c_encoding();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday
+operator+(const weekday& __lhs, const days& __rhs) noexcept {
+ auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
+ auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
+ return weekday{static_cast<unsigned>(__mu - __yr * 7)};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday
+operator+(const days& __lhs, const weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday
+operator-(const weekday& __lhs, const days& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr days
+operator-(const weekday& __lhs, const weekday& __rhs) noexcept {
+ const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
+ const int __wk = (__wdu >= 0 ? __wdu : __wdu - 6) / 7;
+ return days{__wdu - __wk * 7};
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator+=(const days& __dd) noexcept {
+ *this = *this + __dd;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept {
+ *this = *this - __dd;
+ return *this;
+}
+
+class weekday_indexed {
+private:
+ chrono::weekday __wd_;
+ unsigned char __idx_;
+
+public:
+ weekday_indexed() = default;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept
+ : __wd_{__wdval}, __idx_(__idxval) {}
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
+ return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5;
+ }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept {
+ return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index();
+}
+
+class weekday_last {
+private:
+ chrono::weekday __wd_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept : __wd_{__val} {}
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept {
+ return __lhs.weekday() == __rhs.weekday();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed weekday::operator[](unsigned __index) const noexcept {
+ return weekday_indexed{*this, __index};
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_last weekday::operator[](last_spec) const noexcept {
+ return weekday_last{*this};
+}
+
+inline constexpr weekday Sunday{0};
+inline constexpr weekday Monday{1};
+inline constexpr weekday Tuesday{2};
+inline constexpr weekday Wednesday{3};
+inline constexpr weekday Thursday{4};
+inline constexpr weekday Friday{5};
+inline constexpr weekday Saturday{6};
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::weekday> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday& __w) noexcept {
+ return __w.c_encoding();
+ }
+};
+
+template <>
+struct hash<chrono::weekday_indexed> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_indexed& __wi) noexcept {
+ return std::__hash_combine(hash<chrono::weekday>{}(__wi.weekday()), __wi.index());
+ }
+};
+
+template <>
+struct hash<chrono::weekday_last> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_last& __wl) noexcept {
+ return hash<chrono::weekday>{}(__wl.weekday());
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_WEEKDAY_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/year.h b/third_party/libcxx/include/c++/v1/__chrono/year.h
new file mode 100644
index 0000000..208d6eb
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/year.h
@@ -0,0 +1,131 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_YEAR_H
+#define _LIBCPP___CHRONO_YEAR_H
+
+#include <__chrono/duration.h>
+#include <__compare/ordering.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+#include <limits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class year {
+private:
+ short __y_;
+
+public:
+ year() = default;
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y_(static_cast<short>(__val)) {}
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept {
+ ++__y_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator++(int) noexcept {
+ year __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept {
+ --__y_;
+ return *this;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year operator--(int) noexcept {
+ year __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+ _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept;
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept {
+ return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0);
+ }
+ _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year& __lhs, const year& __rhs) noexcept {
+ return static_cast<int>(__lhs) == static_cast<int>(__rhs);
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, const year& __rhs) noexcept {
+ return static_cast<int>(__lhs) <=> static_cast<int>(__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept {
+ return year(static_cast<int>(__lhs) + __rhs.count());
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept {
+ return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)};
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept {
+ static_assert(static_cast<int>(std::numeric_limits<decltype(__y_)>::max()) == static_cast<int>(max()));
+ return static_cast<int>(min()) <= __y_;
+}
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::year> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept {
+ return static_cast<int>(__y);
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___CHRONO_YEAR_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/year_month.h b/third_party/libcxx/include/c++/v1/__chrono/year_month.h
new file mode 100644
index 0000000..fdeeed1
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/year_month.h
@@ -0,0 +1,143 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_YEAR_MONTH_H
+#define _LIBCPP___CHRONO_YEAR_MONTH_H
+
+#include <__chrono/duration.h>
+#include <__chrono/month.h>
+#include <__chrono/year.h>
+#include <__compare/ordering.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class year_month {
+ chrono::year __y_;
+ chrono::month __m_;
+
+public:
+ year_month() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept
+ : __y_{__yval}, __m_{__mval} {}
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept;
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
+};
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept {
+ return year_month{__y, __m};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept {
+ return year_month{__y, month(__m)};
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept {
+ if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
+ return __c;
+ return __lhs.month() <=> __rhs.month();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
+operator+(const year_month& __lhs, const months& __rhs) noexcept {
+ int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count();
+ const int __dy = (__dmi >= 0 ? __dmi : __dmi - 11) / 12;
+ __dmi = __dmi - __dy * 12 + 1;
+ return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi));
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
+operator+(const months& __lhs, const year_month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
+operator+(const year_month& __lhs, const years& __rhs) noexcept {
+ return (__lhs.year() + __rhs) / __lhs.month();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
+operator+(const years& __lhs, const year_month& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr months
+operator-(const year_month& __lhs, const year_month& __rhs) noexcept {
+ return (__lhs.year() - __rhs.year()) +
+ months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month()));
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
+operator-(const year_month& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
+operator-(const year_month& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::year_month> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month& __ym) noexcept {
+ return std::__hash_combine(hash<chrono::year>{}(__ym.year()), hash<chrono::month>{}(__ym.month()));
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_YEAR_MONTH_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/year_month_day.h b/third_party/libcxx/include/c++/v1/__chrono/year_month_day.h
new file mode 100644
index 0000000..b0149d3
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/year_month_day.h
@@ -0,0 +1,371 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_YEAR_MONTH_DAY_H
+#define _LIBCPP___CHRONO_YEAR_MONTH_DAY_H
+
+#include <__chrono/calendar.h>
+#include <__chrono/day.h>
+#include <__chrono/duration.h>
+#include <__chrono/month.h>
+#include <__chrono/monthday.h>
+#include <__chrono/system_clock.h>
+#include <__chrono/time_point.h>
+#include <__chrono/year.h>
+#include <__chrono/year_month.h>
+#include <__compare/ordering.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+#include <limits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class year_month_day_last;
+
+class year_month_day {
+private:
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::day __d_;
+
+public:
+ year_month_day() = default;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
+ : __y_{__yval}, __m_{__mval}, __d_{__dval} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(const sys_days& __sysd) noexcept
+ : year_month_day(__from_days(__sysd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_day(const local_days& __locd) noexcept
+ : year_month_day(__from_days(__locd.time_since_epoch())) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+};
+
+// https://howardhinnant.github.io/date_algorithms.html#civil_from_days
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day year_month_day::__from_days(days __d) noexcept {
+ static_assert(numeric_limits<unsigned>::digits >= 18, "");
+ static_assert(numeric_limits<int>::digits >= 20, "");
+ const int __z = __d.count() + 719468;
+ const int __era = (__z >= 0 ? __z : __z - 146096) / 146097;
+ const unsigned __doe = static_cast<unsigned>(__z - __era * 146097); // [0, 146096]
+ const unsigned __yoe = (__doe - __doe / 1460 + __doe / 36524 - __doe / 146096) / 365; // [0, 399]
+ const int __yr = static_cast<int>(__yoe) + __era * 400;
+ const unsigned __doy = __doe - (365 * __yoe + __yoe / 4 - __yoe / 100); // [0, 365]
+ const unsigned __mp = (5 * __doy + 2) / 153; // [0, 11]
+ const unsigned __dy = __doy - (153 * __mp + 2) / 5 + 1; // [1, 31]
+ const unsigned __mth = __mp + (__mp < 10 ? 3 : -9); // [1, 12]
+ return year_month_day{chrono::year{__yr + (__mth <= 2)}, chrono::month{__mth}, chrono::day{__dy}};
+}
+
+// https://howardhinnant.github.io/date_algorithms.html#days_from_civil
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_day::__to_days() const noexcept {
+ static_assert(numeric_limits<unsigned>::digits >= 18, "");
+ static_assert(numeric_limits<int>::digits >= 20, "");
+
+ const int __yr = static_cast<int>(__y_) - (__m_ <= February);
+ const unsigned __mth = static_cast<unsigned>(__m_);
+ const unsigned __dy = static_cast<unsigned>(__d_);
+
+ const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400;
+ const unsigned __yoe = static_cast<unsigned>(__yr - __era * 400); // [0, 399]
+ const unsigned __doy = (153 * (__mth + (__mth > 2 ? -3 : 9)) + 2) / 5 + __dy - 1; // [0, 365]
+ const unsigned __doe = __yoe * 365 + __yoe / 4 - __yoe / 100 + __doy; // [0, 146096]
+ return days{__era * 146097 + static_cast<int>(__doe) - 719468};
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
+ if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
+ return __c;
+ if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
+ return __c;
+ return __lhs.day() <=> __rhs.day();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator/(const year_month& __lhs, const day& __rhs) noexcept {
+ return year_month_day{__lhs.year(), __lhs.month(), __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator/(const year_month& __lhs, int __rhs) noexcept {
+ return __lhs / day(__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator/(const year& __lhs, const month_day& __rhs) noexcept {
+ return __lhs / __rhs.month() / __rhs.day();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator/(int __lhs, const month_day& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator/(const month_day& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator/(const month_day& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const year_month_day& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.day();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const months& __lhs, const year_month_day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator-(const year_month_day& __lhs, const months& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const year_month_day& __lhs, const years& __rhs) noexcept {
+ return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator+(const years& __lhs, const year_month_day& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
+operator-(const year_month_day& __lhs, const years& __rhs) noexcept {
+ return __lhs + -__rhs;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
+
+class year_month_day_last {
+private:
+ chrono::year __y_;
+ chrono::month_day_last __mdl_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept
+ : __y_{__yval}, __mdl_{__mdlval} {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const months& __m) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const months& __m) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept {
+ return __mdl_;
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept {
+ return sys_days{year() / month() / day()};
+ }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{year() / month() / day()};
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day year_month_day_last::day() const noexcept {
+ constexpr chrono::day __d[] = {
+ chrono::day(31),
+ chrono::day(28),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31),
+ chrono::day(30),
+ chrono::day(31)};
+ return (month() != February || !__y_.is_leap()) && month().ok()
+ ? __d[static_cast<unsigned>(month()) - 1]
+ : chrono::day{29};
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
+operator<=>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
+ if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
+ return __c;
+ return __lhs.month_day_last() <=> __rhs.month_day_last();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator/(const year_month& __lhs, last_spec) noexcept {
+ return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator/(const year& __lhs, const month_day_last& __rhs) noexcept {
+ return year_month_day_last{__lhs, __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator/(int __lhs, const month_day_last& __rhs) noexcept {
+ return year_month_day_last{year{__lhs}, __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator/(const month_day_last& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator/(const month_day_last& __lhs, int __rhs) noexcept {
+ return year{__rhs} / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / last;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept {
+ return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
+operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
+year_month_day_last::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
+ : __y_{__ymdl.year()}, __m_{__ymdl.month()}, __d_{__ymdl.day()} {}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept {
+ if (!__y_.ok() || !__m_.ok())
+ return false;
+ return chrono::day{1} <= __d_ && __d_ <= (__y_ / __m_ / last).day();
+}
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::year_month_day> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day& __ymd) noexcept {
+ return std::__hash_combine(
+ hash<chrono::year>{}(__ymd.year()),
+ std::__hash_combine(hash<chrono::month>{}(__ymd.month()), hash<chrono::day>{}(__ymd.day())));
+ }
+};
+
+template <>
+struct hash<chrono::year_month_day_last> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day_last& __ymdl) noexcept {
+ return std::__hash_combine(
+ hash<chrono::year>{}(__ymdl.year()), hash<chrono::month_day_last>{}(__ymdl.month_day_last()));
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_YEAR_MONTH_DAY_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/year_month_weekday.h b/third_party/libcxx/include/c++/v1/__chrono/year_month_weekday.h
new file mode 100644
index 0000000..eff472f
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/year_month_weekday.h
@@ -0,0 +1,325 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CHRONO_YEAR_MONTH_WEEKDAY_H
+#define _LIBCPP___CHRONO_YEAR_MONTH_WEEKDAY_H
+
+#include <__chrono/calendar.h>
+#include <__chrono/day.h>
+#include <__chrono/duration.h>
+#include <__chrono/month.h>
+#include <__chrono/month_weekday.h>
+#include <__chrono/system_clock.h>
+#include <__chrono/time_point.h>
+#include <__chrono/weekday.h>
+#include <__chrono/year.h>
+#include <__chrono/year_month.h>
+#include <__chrono/year_month_day.h>
+#include <__config>
+#include <__cstddef/size_t.h>
+#include <__functional/hash.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+class year_month_weekday {
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::weekday_indexed __wdi_;
+
+public:
+ year_month_weekday() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept
+ : __y_{__yval}, __m_{__mval}, __wdi_{__wdival} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const sys_days& __sysd) noexcept
+ : year_month_weekday(__from_days(__sysd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept
+ : year_month_weekday(__from_days(__locd.time_since_epoch())) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const months&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const months&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept {
+ return __wdi_.weekday();
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept {
+ return __wdi_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
+ if (!__y_.ok() || !__m_.ok() || !__wdi_.ok())
+ return false;
+ if (__wdi_.index() <= 4)
+ return true;
+ auto __nth_weekday_day =
+ __wdi_.weekday() - chrono::weekday{static_cast<sys_days>(__y_ / __m_ / 1)} + days{(__wdi_.index() - 1) * 7 + 1};
+ return static_cast<unsigned>(__nth_weekday_day.count()) <= static_cast<unsigned>((__y_ / __m_ / last).day());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr year_month_weekday __from_days(days __d) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday year_month_weekday::__from_days(days __d) noexcept {
+ const sys_days __sysd{__d};
+ const chrono::weekday __wd = chrono::weekday(__sysd);
+ const year_month_day __ymd = year_month_day(__sysd);
+ return year_month_weekday{__ymd.year(), __ymd.month(), __wd[(static_cast<unsigned>(__ymd.day()) - 1) / 7 + 1]};
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday::__to_days() const noexcept {
+ const sys_days __sysd = sys_days(__y_ / __m_ / 1);
+ return (__sysd + (__wdi_.weekday() - chrono::weekday(__sysd) + days{(__wdi_.index() - 1) * 7})).time_since_epoch();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() &&
+ __lhs.weekday_indexed() == __rhs.weekday_indexed();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept {
+ return year_month_weekday{__lhs.year(), __lhs.month(), __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const year& __lhs, const month_weekday& __rhs) noexcept {
+ return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(int __lhs, const month_weekday& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const month_weekday& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator/(const month_weekday& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept {
+ return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
+operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
+
+class year_month_weekday_last {
+private:
+ chrono::year __y_;
+ chrono::month __m_;
+ chrono::weekday_last __wdl_;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last(
+ const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept
+ : __y_{__yval}, __m_{__mval}, __wdl_{__wdlval} {}
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept;
+ _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept;
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept {
+ return __wdl_.weekday();
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept {
+ return __wdl_;
+ }
+ _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
+ _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
+ return local_days{__to_days()};
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
+ return __y_.ok() && __m_.ok() && __wdl_.ok();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
+};
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday_last::__to_days() const noexcept {
+ const sys_days __last = sys_days{__y_ / __m_ / last};
+ return (__last - (chrono::weekday{__last} - __wdl_.weekday())).time_since_epoch();
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr bool
+operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept {
+ return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept {
+ return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(int __lhs, const month_weekday_last& __rhs) noexcept {
+ return year(__lhs) / __rhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept {
+ return __rhs / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator/(const month_weekday_last& __lhs, int __rhs) noexcept {
+ return year(__rhs) / __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
+ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last();
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
+ return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()};
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept {
+ return __rhs + __lhs;
+}
+
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
+operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
+ return __lhs + (-__rhs);
+}
+
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator+=(const months& __dm) noexcept {
+ *this = *this + __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator-=(const months& __dm) noexcept {
+ *this = *this - __dm;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator+=(const years& __dy) noexcept {
+ *this = *this + __dy;
+ return *this;
+}
+_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
+year_month_weekday_last::operator-=(const years& __dy) noexcept {
+ *this = *this - __dy;
+ return *this;
+}
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <>
+struct hash<chrono::year_month_weekday> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday& __ymw) noexcept {
+ return std::__hash_combine(
+ hash<chrono::year>{}(__ymw.year()),
+ std::__hash_combine(
+ hash<chrono::month>{}(__ymw.month()), hash<chrono::weekday_indexed>{}(__ymw.weekday_indexed())));
+ }
+};
+
+template <>
+struct hash<chrono::year_month_weekday_last> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday_last& __ymwl) noexcept {
+ return std::__hash_combine(
+ hash<chrono::year>{}(__ymwl.year()),
+ std::__hash_combine(
+ hash<chrono::month>{}(__ymwl.month()), hash<chrono::weekday_last>{}(__ymwl.weekday_last())));
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 20
+
+#endif // _LIBCPP___CHRONO_YEAR_MONTH_WEEKDAY_H
diff --git a/third_party/libcxx/include/c++/v1/__chrono/zoned_time.h b/third_party/libcxx/include/c++/v1/__chrono/zoned_time.h
new file mode 100644
index 0000000..e63528e
--- /dev/null
+++ b/third_party/libcxx/include/c++/v1/__chrono/zoned_time.h
@@ -0,0 +1,244 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_ZONED_TIME_H
+#define _LIBCPP___CHRONO_ZONED_TIME_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+# include <__chrono/calendar.h>
+# include <__chrono/duration.h>
+# include <__chrono/sys_info.h>
+# include <__chrono/system_clock.h>
+# include <__chrono/time_zone.h>
+# include <__chrono/tzdb_list.h>
+# include <__concepts/constructible.h>
+# include <__config>
+# include <__cstddef/size_t.h>
+# include <__functional/hash.h>
+# include <__type_traits/common_type.h>
+# include <__type_traits/conditional.h>
+# include <__type_traits/remove_cvref.h>
+# include <__utility/declval.h>
+# include <__utility/move.h>
+# include <string_view>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_PUSH_MACROS
+# include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
+
+namespace chrono {
+
+template <class>
+struct zoned_traits {};
+
+template <>
+struct zoned_traits<const time_zone*> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* default_zone() { return chrono::locate_zone("UTC"); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* locate_zone(string_view __name) {
+ return chrono::locate_zone(__name);
+ }
+};
+
+template <class _Duration, class _TimeZonePtr = const time_zone*>
+class zoned_time {
+ // [time.zone.zonedtime.ctor]/2
+ static_assert(__is_duration_v<_Duration>,
+ "the program is ill-formed since _Duration is not a specialization of std::chrono::duration");
+
+ // The wording uses the constraints like
+ // constructible_from<zoned_time, decltype(__traits::locate_zone(string_view{}))>
+ // Using these constraints in the code causes the compiler to give an
+ // error that the constraint depends on itself. To avoid that issue use
+ // the fact it is possible to create this object from a _TimeZonePtr.
+ using __traits _LIBCPP_NODEBUG = zoned_traits<_TimeZonePtr>;
+
+public:
+ using duration = common_type_t<_Duration, seconds>;
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time()
+ requires requires { __traits::default_zone(); }
+ : __zone_{__traits::default_zone()}, __tp_{} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time&) = default;
+ _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const zoned_time&) = default;
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(const sys_time<_Duration>& __tp)
+ requires requires { __traits::default_zone(); }
+ : __zone_{__traits::default_zone()}, __tp_{__tp} {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit zoned_time(_TimeZonePtr __zone) : __zone_{std::move(__zone)}, __tp_{} {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit zoned_time(string_view __name)
+ requires(requires { __traits::locate_zone(string_view{}); } &&
+ constructible_from<_TimeZonePtr, decltype(__traits::locate_zone(string_view{}))>)
+ : __zone_{__traits::locate_zone(__name)}, __tp_{} {}
+
+ template <class _Duration2>
+ _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time<_Duration2, _TimeZonePtr>& __zt)
+ requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>
+ : __zone_{__zt.get_time_zone()}, __tp_{__zt.get_sys_time()} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const sys_time<_Duration>& __tp)
+ : __zone_{std::move(__zone)}, __tp_{__tp} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const sys_time<_Duration>& __tp)
+ requires requires { _TimeZonePtr{__traits::locate_zone(string_view{})}; }
+ : zoned_time{__traits::locate_zone(__name), __tp} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const local_time<_Duration>& __tp)
+ requires(is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})),
+ sys_time<duration>>)
+ : __zone_{std::move(__zone)}, __tp_{__zone_->to_sys(__tp)} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const local_time<_Duration>& __tp)
+ requires(requires {
+ _TimeZonePtr{__traits::locate_zone(string_view{})};
+ } && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})),
+ sys_time<duration>>)
+ : zoned_time{__traits::locate_zone(__name), __tp} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const local_time<_Duration>& __tp, choose __c)
+ requires(is_convertible_v<
+ decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{}, choose::earliest)),
+ sys_time<duration>>)
+ : __zone_{std::move(__zone)}, __tp_{__zone_->to_sys(__tp, __c)} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const local_time<_Duration>& __tp, choose __c)
+ requires(requires {
+ _TimeZonePtr{__traits::locate_zone(string_view{})};
+ } && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{}, choose::earliest)),
+ sys_time<duration>>)
+ : zoned_time{__traits::locate_zone(__name), __tp, __c} {}
+
+ template <class _Duration2, class _TimeZonePtr2>
+ _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const zoned_time<_Duration2, _TimeZonePtr2>& __zt)
+ requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>
+ : __zone_{std::move(__zone)}, __tp_{__zt.get_sys_time()} {}
+
+ // per wording choose has no effect
+ template <class _Duration2, class _TimeZonePtr2>
+ _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const zoned_time<_Duration2, _TimeZonePtr2>& __zt, choose)
+ requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>
+ : __zone_{std::move(__zone)}, __tp_{__zt.get_sys_time()} {}
+
+ template <class _Duration2, class _TimeZonePtr2>
+ _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const zoned_time<_Duration2, _TimeZonePtr2>& __zt)
+ requires(requires {
+ _TimeZonePtr{__traits::locate_zone(string_view{})};
+ } && is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>)
+ : zoned_time{__traits::locate_zone(__name), __zt} {}
+
+ template <class _Duration2, class _TimeZonePtr2>
+ _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const zoned_time<_Duration2, _TimeZonePtr2>& __zt, choose __c)
+ requires(requires {
+ _TimeZonePtr{__traits::locate_zone(string_view{})};
+ } && is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>)
+ : zoned_time{__traits::locate_zone(__name), __zt, __c} {}
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const sys_time<_Duration>& __tp) {
+ __tp_ = __tp;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const local_time<_Duration>& __tp) {
+ // TODO TZDB This seems wrong.
+ // Assigning a non-existent or ambiguous time will throw and not satisfy
+ // the post condition. This seems quite odd; I constructed an object with
+ // choose::earliest and that choice is not respected.
+ // what did LEWG do with this.
+ // MSVC STL and libstdc++ behave the same
+ __tp_ = __zone_->to_sys(__tp);
+ return *this;
+ }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI operator sys_time<duration>() const { return get_sys_time(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit operator local_time<duration>() const { return get_local_time(); }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _TimeZonePtr get_time_zone() const { return __zone_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_time<duration> get_local_time() const { return __zone_->to_local(__tp_); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<duration> get_sys_time() const { return __tp_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_info get_info() const { return __zone_->get_info(__tp_); }
+
+private:
+ _TimeZonePtr __zone_;
+ sys_time<duration> __tp_;
+};
+
+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 _LIBCPP_NODEBUG =
+ 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>>;
+
+using zoned_seconds = zoned_time<seconds>;
+
+template <class _Duration1, class _Duration2, class _TimeZonePtr>
+_LIBCPP_HIDE_FROM_ABI bool
+operator==(const zoned_time<_Duration1, _TimeZonePtr>& __lhs, const zoned_time<_Duration2, _TimeZonePtr>& __rhs) {
+ return __lhs.get_time_zone() == __rhs.get_time_zone() && __lhs.get_sys_time() == __rhs.get_sys_time();
+}
+
+} // namespace chrono
+
+# if _LIBCPP_STD_VER >= 26
+
+template <class _Duration, class _TimeZonePtr>
+ requires __has_enabled_hash<_Duration>::value && __has_enabled_hash<_TimeZonePtr>::value
+struct hash<chrono::zoned_time<_Duration, _TimeZonePtr>> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t
+ operator()(const chrono::zoned_time<_Duration, _TimeZonePtr>& __zt) {
+ return std::__hash_combine(
+ hash<chrono::sys_time<_Duration>>{}(__zt.get_sys_time()), hash<_TimeZonePtr>{}(__zt.get_time_zone()));
+ }
+};
+
+# endif // _LIBCPP_STD_VER >= 26
+
+# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
+ // _LIBCPP_HAS_LOCALIZATION
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
+
+#endif // _LIBCPP___CHRONO_ZONED_TIME_H