blob: fec7093c2eb66e49327712e574e943f04015fc43 [file] [log] [blame]
diff --git a/source/common/putil.cpp b/source/common/putil.cpp
index 5f09288..c87b60e 100644
--- a/source/common/putil.cpp
+++ b/source/common/putil.cpp
@@ -970,6 +970,15 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
return result;
}
#endif
+
+U_CAPI void U_EXPORT2
+uprv_tzname_clear_cache()
+{
+#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
+ gTimeZoneBufferPtr = NULL;
+#endif
+}
+
U_CAPI const char* U_EXPORT2
uprv_tzname(int n)
{
diff --git a/source/common/putilimp.h b/source/common/putilimp.h
index 5de801f..55ec0ae 100644
--- a/source/common/putilimp.h
+++ b/source/common/putilimp.h
@@ -479,6 +479,12 @@ U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void);
U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
/**
+ * Reset the global tzname cache.
+ * @internal
+ */
+U_INTERNAL void uprv_tzname_clear_cache();
+
+/**
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
* This function is affected by 'faketime' and should be the bottleneck for all user-visible ICU time functions.
* @return the UTC time measured in milliseconds
diff --git a/source/i18n/timezone.cpp b/source/i18n/timezone.cpp
index 59c3891..00eca38 100644
--- a/source/i18n/timezone.cpp
+++ b/source/i18n/timezone.cpp
@@ -458,6 +458,8 @@ TimeZone::detectHostTimeZone()
uprv_tzset(); // Initialize tz... system data
+ uprv_tzname_clear_cache();
+
// Get the timezone ID from the host. This function should do
// any required host-specific remapping; e.g., on Windows this
// function maps the Date and Time control panel setting to an