From df9c3de5ba8e62e867ec0c89cbea84f98fefbae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 2 Sep 2023 21:44:21 +0200 Subject: [PATCH] [DXDIAG] Remove a "redundant" GetTimeZoneInformation() call. Indeed, the next SystemTimeToTzSpecificLocalTime() call, when done with a NULL TIME_ZONE_INFORMATION* 1st parameter, uses the currently active time zone, which is exactly what the GetTimeZoneInformation() call was doing. And note that the original code was incorrectly validating the returned value from GetTimeZoneInformation() -- the code was assuming the function returns a boolean, instead of checking for TIME_ZONE_ID_INVALID. --- base/applications/dxdiag/display.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/base/applications/dxdiag/display.c b/base/applications/dxdiag/display.c index eae055589f4..14228720d23 100644 --- a/base/applications/dxdiag/display.c +++ b/base/applications/dxdiag/display.c @@ -18,7 +18,6 @@ GetFileModifyTime(LPCWSTR pFullPath, WCHAR * szTime, int szTimeSize) FILETIME AccessTime; SYSTEMTIME SysTime, LocalTime; UINT Length; - TIME_ZONE_INFORMATION TimeInfo; hFile = CreateFileW(pFullPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); if (!hFile) @@ -31,13 +30,10 @@ GetFileModifyTime(LPCWSTR pFullPath, WCHAR * szTime, int szTimeSize) } CloseHandle(hFile); - if(!GetTimeZoneInformation(&TimeInfo)) - return FALSE; - if (!FileTimeToSystemTime(&AccessTime, &SysTime)) return FALSE; - if (!SystemTimeToTzSpecificLocalTime(&TimeInfo, &SysTime, &LocalTime)) + if (!SystemTimeToTzSpecificLocalTime(NULL, &SysTime, &LocalTime)) return FALSE; Length = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &LocalTime, NULL, szTime, szTimeSize);