aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src/time_zone.cpp
diff options
context:
space:
mode:
authorMark de Wever <koraq@xs4all.nl>2024-02-17 14:28:01 +0100
committerGitHub <noreply@github.com>2024-02-17 14:28:01 +0100
commitd332d88b919faa15564ab70b0633d94f21bc3e3c (patch)
tree3108d99ec93b8678cf22b84c05f2cdfdcdbcbed5 /libcxx/src/time_zone.cpp
parentded3ca224f7c2b1df769d625985ab20bb60dfba4 (diff)
downloadllvm-d332d88b919faa15564ab70b0633d94f21bc3e3c.zip
llvm-d332d88b919faa15564ab70b0633d94f21bc3e3c.tar.gz
llvm-d332d88b919faa15564ab70b0633d94f21bc3e3c.tar.bz2
[libc++][chrono] Loads tzdata.zi in tzdb. (#74928)
This implements the loading of the tzdata.zi file and store its contents in the tzdb struct. This adds all required members except: - the leap seconds, - the locate_zone, and - current_zone. The class time_zone is incomplete and only contains the parts needed for storing the parsed data. The class time_zone_link is fully implemented including its non-member functions. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones - P1614 The Mothership has Landed Implements: - P1982 Rename link to time_zone_link
Diffstat (limited to 'libcxx/src/time_zone.cpp')
-rw-r--r--libcxx/src/time_zone.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/libcxx/src/time_zone.cpp b/libcxx/src/time_zone.cpp
new file mode 100644
index 0000000..b6bf06a
--- /dev/null
+++ b/libcxx/src/time_zone.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+#include <chrono>
+
+#include "include/tzdb/time_zone_private.h"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace chrono {
+
+[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI time_zone time_zone::__create(unique_ptr<time_zone::__impl>&& __p) {
+ _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "initialized time_zone without a valid pimpl object");
+ time_zone result;
+ result.__impl_ = std::move(__p);
+ return result;
+}
+
+_LIBCPP_EXPORTED_FROM_ABI time_zone::~time_zone() = default;
+
+[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI string_view time_zone::__name() const noexcept { return __impl_->__name(); }
+
+} // namespace chrono
+
+_LIBCPP_END_NAMESPACE_STD