|
39 | 39 | #include <sdkddkver.h> |
40 | 40 | // Include only when the SDK is for Windows 10 (and later), and the binary is |
41 | 41 | // targeted for Windows XP and later. |
42 | | -#if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP) |
| 42 | +// Note: The Windows SDK added windows.globalization.h file for Windows 10, but |
| 43 | +// MinGW did not add it until NTDDI_WIN10_NI (SDK version 10.0.22621.0). |
| 44 | +#if ((defined(_WIN32_WINNT_WIN10) && !defined(__MINGW32__)) || \ |
| 45 | + (defined(NTDDI_WIN10_NI) && NTDDI_VERSION >= NTDDI_WIN10_NI)) && \ |
| 46 | + (_WIN32_WINNT >= _WIN32_WINNT_WINXP) |
| 47 | +#define USE_WIN32_LOCAL_TIME_ZONE |
43 | 48 | #include <roapi.h> |
44 | 49 | #include <tchar.h> |
45 | 50 | #include <wchar.h> |
@@ -87,7 +92,7 @@ int __system_property_get(const char* name, char* value) { |
87 | 92 | } |
88 | 93 | #endif |
89 | 94 |
|
90 | | -#if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP) |
| 95 | +#if defined(USE_WIN32_LOCAL_TIME_ZONE) |
91 | 96 | // Calls the WinRT Calendar.GetTimeZone method to obtain the IANA ID of the |
92 | 97 | // local time zone. Returns an empty vector in case of an error. |
93 | 98 | std::string win32_local_time_zone(const HMODULE combase) { |
@@ -278,7 +283,7 @@ time_zone local_time_zone() { |
278 | 283 | zone = primary_tz.c_str(); |
279 | 284 | } |
280 | 285 | #endif |
281 | | -#if defined(_WIN32_WINNT_WIN10) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP) |
| 286 | +#if defined(USE_WIN32_LOCAL_TIME_ZONE) |
282 | 287 | // Use the WinRT Calendar class to get the local time zone. This feature is |
283 | 288 | // available on Windows 10 and later. The library is dynamically linked to |
284 | 289 | // maintain binary compatibility with Windows XP - Windows 7. On Windows 8, |
|
0 commit comments