summaryrefslogtreecommitdiff
path: root/absl/time
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-08-04 12:16:54 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-08-04 12:17:32 -0700
commit659b77b713fe5f1f75e6e1bb121c0eed1c8f964a (patch)
treeebc1a92fee2f652d86570f59ee4c2b159c6bbaf0 /absl/time
parent8f241e778c08cfb4213877b5022442a8d1921b58 (diff)
Import of CCTZ from GitHub.
PiperOrigin-RevId: 553878129 Change-Id: I054a5bd4c9011155c9fe03df0f07803ad7d2ade3
Diffstat (limited to 'absl/time')
-rw-r--r--absl/time/internal/cctz/src/time_zone_lookup.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/absl/time/internal/cctz/src/time_zone_lookup.cc b/absl/time/internal/cctz/src/time_zone_lookup.cc
index 9a30ba5e..d22691bd 100644
--- a/absl/time/internal/cctz/src/time_zone_lookup.cc
+++ b/absl/time/internal/cctz/src/time_zone_lookup.cc
@@ -39,7 +39,12 @@
#include <sdkddkver.h>
// Include only when the SDK is for Windows 10 (and later), and the binary is
// targeted for Windows XP and later.
-#if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+// Note: The Windows SDK added windows.globalization.h file for Windows 10, but
+// MinGW did not add it until NTDDI_WIN10_NI (SDK version 10.0.22621.0).
+#if ((defined(_WIN32_WINNT_WIN10) && !defined(__MINGW32__)) || \
+ (defined(NTDDI_WIN10_NI) && NTDDI_VERSION >= NTDDI_WIN10_NI)) && \
+ (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+#define USE_WIN32_LOCAL_TIME_ZONE
#include <roapi.h>
#include <tchar.h>
#include <wchar.h>
@@ -87,7 +92,7 @@ int __system_property_get(const char* name, char* value) {
}
#endif
-#if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+#if defined(USE_WIN32_LOCAL_TIME_ZONE)
// Calls the WinRT Calendar.GetTimeZone method to obtain the IANA ID of the
// local time zone. Returns an empty vector in case of an error.
std::string win32_local_time_zone(const HMODULE combase) {
@@ -278,7 +283,7 @@ time_zone local_time_zone() {
zone = primary_tz.c_str();
}
#endif
-#if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+#if defined(USE_WIN32_LOCAL_TIME_ZONE)
// Use the WinRT Calendar class to get the local time zone. This feature is
// available on Windows 10 and later. The library is dynamically linked to
// maintain binary compatibility with Windows XP - Windows 7. On Windows 8,