1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

LibTimeZone: Add an API to retrieve a list of all known IANA time zones

This commit is contained in:
Timothy Flynn 2022-01-19 18:05:31 -05:00 committed by Linus Groh
parent 0a4430fc41
commit da27937144
3 changed files with 27 additions and 0 deletions

View file

@ -31,6 +31,16 @@ StringView current_time_zone()
return canonicalize_time_zone(tzname[0]).value_or("UTC"sv);
}
Span<StringView const> __attribute__((weak)) all_time_zones()
{
#if !ENABLE_TIME_ZONE_DATA
static constexpr auto utc = Array { "UTC"sv };
return utc;
#else
return {};
#endif
}
Optional<TimeZone> __attribute__((weak)) time_zone_from_string([[maybe_unused]] StringView time_zone)
{
#if !ENABLE_TIME_ZONE_DATA