LibUnicode: Cache all created icu::TimeZone objects

This cache works exactly the same as the existing icu::Locale cache.
This commit is contained in:
Timothy Flynn 2024-09-03 11:20:20 -04:00 committed by Andreas Kling
commit d392c38a73
Notes: github-actions[bot] 2024-09-03 17:26:56 +00:00
5 changed files with 45 additions and 7 deletions

View file

@ -622,9 +622,9 @@ static void apply_time_zone_to_formatter(icu::SimpleDateFormat& formatter, icu::
{
UErrorCode status = U_ZERO_ERROR;
auto* time_zone = icu::TimeZone::createTimeZone(icu_string(time_zone_identifier));
auto time_zone_data = TimeZoneData::for_time_zone(time_zone_identifier);
auto* calendar = icu::Calendar::createInstance(time_zone, locale, status);
auto* calendar = icu::Calendar::createInstance(time_zone_data->time_zone(), locale, status);
VERIFY(icu_success(status));
if (calendar->getDynamicClassID() == icu::GregorianCalendar::getStaticClassID()) {