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

LibTimeZone: Canonicalize the current time zone and fall back to UTC

If the tzname is unknown, fall back to UTC for now. Unknown time zones
are most likely due to not parsing RULE entries yet, but at the very
least, it only makes sense for current_time_zone to return a time zone
that LibTimeZone actually knows about.
This commit is contained in:
Timothy Flynn 2022-01-14 13:07:19 -05:00 committed by Linus Groh
parent 094b88e6a5
commit 247caac7a8

View file

@ -28,7 +28,7 @@ StringView current_time_zone()
tzset();
}
return tzname[0];
return canonicalize_time_zone(tzname[0]).value_or("UTC"sv);
}
Optional<TimeZone> __attribute__((weak)) time_zone_from_string([[maybe_unused]] StringView time_zone)