diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-01-19 18:05:31 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-23 12:48:26 +0000 |
commit | da27937144f1d23bbca39c4e2f7a7bc1484b2dc1 (patch) | |
tree | 154c2471d8aec6a8e95bdf008e218f0ab56cbfd0 /Meta | |
parent | 0a4430fc417d8cd06ffd191eff3464efbf5dd736 (diff) | |
download | serenity-da27937144f1d23bbca39c4e2f7a7bc1484b2dc1.zip |
LibTimeZone: Add an API to retrieve a list of all known IANA time zones
Diffstat (limited to 'Meta')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp index b83d5312b1..b98dc3574e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp @@ -524,6 +524,22 @@ Optional<Offset> get_time_zone_offset(TimeZone time_zone, AK::Time time) return dst_offset; } +Span<StringView const> all_time_zones() +{ + static constexpr auto all_time_zones = Array { + )~~~"); + + for (auto const& time_zone : time_zone_data.time_zone_names) { + generator.set("time_zone", time_zone); + generator.append("\"@time_zone@\"sv, "); + } + + generator.append(R"~~~( + }; + + return all_time_zones; +} + } )~~~"); |