diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-01-07 09:05:35 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-08 12:45:34 +0100 |
commit | 87abf00f7c2b70614fa9b5a99ade32a4ee4a9d55 (patch) | |
tree | 28fedb68d0e156277690d4eede42f352a2a5973e /Meta | |
parent | b5758a062323e80e5b1d70cfd0256b284f3a4ec2 (diff) | |
download | serenity-87abf00f7c2b70614fa9b5a99ade32a4ee4a9d55.zip |
LibTimeZone: Extract and parse the backwards compatibility LINK entries
This set of LINK entries contains the link from "UTC" to "Etc/UTC",
which LibJS will heavily depend upon.
Diffstat (limited to 'Meta')
-rw-r--r-- | Meta/CMake/time_zone_data.cmake | 6 | ||||
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp | 16 |
2 files changed, 14 insertions, 8 deletions
diff --git a/Meta/CMake/time_zone_data.cmake b/Meta/CMake/time_zone_data.cmake index 09a6c2bbc2..6ba561b9cf 100644 --- a/Meta/CMake/time_zone_data.cmake +++ b/Meta/CMake/time_zone_data.cmake @@ -20,6 +20,9 @@ set(TZDB_ASIA_PATH "${TZDB_PATH}/${TZDB_ASIA_SOURCE}") set(TZDB_AUSTRALASIA_SOURCE australasia) set(TZDB_AUSTRALASIA_PATH "${TZDB_PATH}/${TZDB_AUSTRALASIA_SOURCE}") +set(TZDB_BACKWARD_SOURCE backward) +set(TZDB_BACKWARD_PATH "${TZDB_PATH}/${TZDB_BACKWARD_SOURCE}") + set(TZDB_ETCETERA_SOURCE etcetera) set(TZDB_ETCETERA_PATH "${TZDB_PATH}/${TZDB_ETCETERA_SOURCE}") @@ -54,6 +57,7 @@ if (ENABLE_TIME_ZONE_DATABASE_DOWNLOAD) extract_tzdb_file("${TZDB_ANTARCTICA_SOURCE}" "${TZDB_ANTARCTICA_PATH}") extract_tzdb_file("${TZDB_ASIA_SOURCE}" "${TZDB_ASIA_PATH}") extract_tzdb_file("${TZDB_AUSTRALASIA_SOURCE}" "${TZDB_AUSTRALASIA_PATH}") + extract_tzdb_file("${TZDB_BACKWARD_SOURCE}" "${TZDB_BACKWARD_PATH}") extract_tzdb_file("${TZDB_ETCETERA_SOURCE}" "${TZDB_ETCETERA_PATH}") extract_tzdb_file("${TZDB_EUROPE_SOURCE}" "${TZDB_EUROPE_PATH}") extract_tzdb_file("${TZDB_NORTH_AMERICA_SOURCE}" "${TZDB_NORTH_AMERICA_PATH}") @@ -78,7 +82,7 @@ if (ENABLE_TIME_ZONE_DATABASE_DOWNLOAD) "${TIME_ZONE_META_TARGET_PREFIX}" "${TIME_ZONE_DATA_HEADER}" "${TIME_ZONE_DATA_IMPLEMENTATION}" - arguments "${TZDB_AFRICA_PATH}" "${TZDB_ANTARCTICA_PATH}" "${TZDB_ASIA_PATH}" "${TZDB_AUSTRALASIA_PATH}" "${TZDB_ETCETERA_PATH}" "${TZDB_EUROPE_PATH}" "${TZDB_NORTH_AMERICA_PATH}" "${TZDB_SOUTH_AMERICA_PATH}" + arguments "${TZDB_AFRICA_PATH}" "${TZDB_ANTARCTICA_PATH}" "${TZDB_ASIA_PATH}" "${TZDB_AUSTRALASIA_PATH}" "${TZDB_BACKWARD_PATH}" "${TZDB_ETCETERA_PATH}" "${TZDB_EUROPE_PATH}" "${TZDB_NORTH_AMERICA_PATH}" "${TZDB_SOUTH_AMERICA_PATH}" ) set(TIME_ZONE_DATA_SOURCES diff --git a/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp index d1acd231ce..f5cd8fbbde 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp @@ -168,15 +168,17 @@ static ErrorOr<void> parse_time_zones(StringView time_zone_path, TimeZoneData& t static String format_identifier(StringView owner, String identifier) { - constexpr auto gmt_time_zone = "Etc/GMT"sv; + constexpr auto gmt_time_zones = Array { "Etc/GMT"sv, "GMT"sv }; - if (identifier.starts_with(gmt_time_zone)) { - auto offset = identifier.substring_view(gmt_time_zone.length()); + for (auto gmt_time_zone : gmt_time_zones) { + if (identifier.starts_with(gmt_time_zone)) { + auto offset = identifier.substring_view(gmt_time_zone.length()); - if (offset.starts_with('+')) - identifier = String::formatted("{}_P{}", gmt_time_zone, offset.substring_view(1)); - else if (offset.starts_with('-')) - identifier = String::formatted("{}_M{}", gmt_time_zone, offset.substring_view(1)); + if (offset.starts_with('+')) + identifier = String::formatted("{}_P{}", gmt_time_zone, offset.substring_view(1)); + else if (offset.starts_with('-')) + identifier = String::formatted("{}_M{}", gmt_time_zone, offset.substring_view(1)); + } } identifier = identifier.replace("-"sv, "_"sv, true); |