diff options
author | Tomasz Konojacki <me@xenu.pl> | 2022-08-07 23:20:23 +0200 |
---|---|---|
committer | xenu <me@xenu.pl> | 2022-08-09 03:09:52 +0200 |
commit | f7e7b4d5e7c86d3d5df8a744581a7f7390fc64ce (patch) | |
tree | f8b95fa1c8dd1a43e6afae9be898900647e99733 /win32 | |
parent | 86584ca859d391d6980fa941b8c2438bb8a6280e (diff) | |
download | perl-f7e7b4d5e7c86d3d5df8a744581a7f7390fc64ce.tar.gz |
win32.c: use _mkgmtime() instead of mktime() in stat()
Conversion to local time seems unnecessary and it apparently causes
issues with DST.
Fixes #20018, #20061
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/win32/win32.c b/win32/win32.c index 1bd02efae9..e861ed39e1 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1469,24 +1469,21 @@ win32_kill(int pid, int sig) PERL_STATIC_INLINE time_t translate_ft_to_time_t(FILETIME ft) { - SYSTEMTIME st, local_st; + SYSTEMTIME st; struct tm pt; - if (!FileTimeToSystemTime(&ft, &st) || - !SystemTimeToTzSpecificLocalTime(NULL, &st, &local_st)) { + if (!FileTimeToSystemTime(&ft, &st)) return -1; - } Zero(&pt, 1, struct tm); - pt.tm_year = local_st.wYear - 1900; - pt.tm_mon = local_st.wMonth - 1; - pt.tm_mday = local_st.wDay; - pt.tm_hour = local_st.wHour; - pt.tm_min = local_st.wMinute; - pt.tm_sec = local_st.wSecond; - pt.tm_isdst = -1; - - return mktime(&pt); + pt.tm_year = st.wYear - 1900; + pt.tm_mon = st.wMonth - 1; + pt.tm_mday = st.wDay; + pt.tm_hour = st.wHour; + pt.tm_min = st.wMinute; + pt.tm_sec = st.wSecond; + + return _mkgmtime(&pt); } typedef DWORD (__stdcall *pGetFinalPathNameByHandleA_t)(HANDLE, LPSTR, DWORD, DWORD); |