summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-12-28 12:53:53 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-08 12:45:34 +0100
commit9253e695d129ca28b570a4fdebabb8e25433c2da (patch)
tree2531b14e31a9de6f4799d000264aa9b52ca9dce3 /Userland/Libraries
parent41f4a5050c80b738c45808b855be401ecff36d80 (diff)
downloadserenity-9253e695d129ca28b570a4fdebabb8e25433c2da.zip
LibTimeZone: Parse ZONE entries from the TZDB and generate their names
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibTimeZone/CMakeLists.txt12
-rw-r--r--Userland/Libraries/LibTimeZone/Forward.h15
-rw-r--r--Userland/Libraries/LibTimeZone/TimeZone.cpp13
-rw-r--r--Userland/Libraries/LibTimeZone/TimeZone.h17
4 files changed, 57 insertions, 0 deletions
diff --git a/Userland/Libraries/LibTimeZone/CMakeLists.txt b/Userland/Libraries/LibTimeZone/CMakeLists.txt
index 2053b93ef3..834a19747f 100644
--- a/Userland/Libraries/LibTimeZone/CMakeLists.txt
+++ b/Userland/Libraries/LibTimeZone/CMakeLists.txt
@@ -6,3 +6,15 @@ if (DEFINED TIME_ZONE_DATA_SOURCES)
target_compile_options(LibTimeZoneData PRIVATE -g0 -Os)
target_link_libraries(LibTimeZoneData LibCore)
endif()
+
+set(SOURCES
+ TimeZone.cpp
+)
+
+serenity_lib(LibTimeZone timezone)
+target_link_libraries(LibTimeZone LibCore)
+target_compile_definitions(LibTimeZone PRIVATE ENABLE_TIME_ZONE_DATA=$<BOOL:${ENABLE_TIME_ZONE_DATABASE_DOWNLOAD}>)
+
+if (DEFINED TIME_ZONE_DATA_SOURCES)
+ target_link_libraries(LibTimeZone LibTimeZoneData)
+endif()
diff --git a/Userland/Libraries/LibTimeZone/Forward.h b/Userland/Libraries/LibTimeZone/Forward.h
new file mode 100644
index 0000000000..bc4cd8dc00
--- /dev/null
+++ b/Userland/Libraries/LibTimeZone/Forward.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2022, Tim Flynn <trflynn89@pm.me>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Types.h>
+
+namespace TimeZone {
+
+enum class TimeZone : u16;
+
+}
diff --git a/Userland/Libraries/LibTimeZone/TimeZone.cpp b/Userland/Libraries/LibTimeZone/TimeZone.cpp
new file mode 100644
index 0000000000..479aad1ddf
--- /dev/null
+++ b/Userland/Libraries/LibTimeZone/TimeZone.cpp
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2022, Tim Flynn <trflynn89@pm.me>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibTimeZone/TimeZone.h>
+
+namespace TimeZone {
+
+Optional<TimeZone> __attribute__((weak)) time_zone_from_string(StringView) { return {}; }
+
+}
diff --git a/Userland/Libraries/LibTimeZone/TimeZone.h b/Userland/Libraries/LibTimeZone/TimeZone.h
new file mode 100644
index 0000000000..552755dfee
--- /dev/null
+++ b/Userland/Libraries/LibTimeZone/TimeZone.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2022, Tim Flynn <trflynn89@pm.me>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Optional.h>
+#include <AK/StringView.h>
+#include <LibTimeZone/Forward.h>
+
+namespace TimeZone {
+
+Optional<TimeZone> time_zone_from_string(StringView time_zone);
+
+}