[Bug 53355] New: Missing functions SystemTimeToTzSpecificLocalTimeEx and TzSpecificLocalTimeToSystemTimeEx

WineHQ Bugzilla wine-bugs at winehq.org
Fri Jul 15 08:27:48 CDT 2022


https://bugs.winehq.org/show_bug.cgi?id=53355

            Bug ID: 53355
           Summary: Missing functions SystemTimeToTzSpecificLocalTimeEx
                    and TzSpecificLocalTimeToSystemTimeEx
           Product: Wine
           Version: unspecified
          Hardware: x86-64
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: kernel32
          Assignee: wine-bugs at winehq.org
          Reporter: osmanx at problemloesungsmaschine.de
      Distribution: ---

Created attachment 72743
  --> https://bugs.winehq.org/attachment.cgi?id=72743
tz.exe

Please implement SystemTimeToTzSpecificLocalTimeEx and
TzSpecificLocalTimeToSystemTimeEx. The documentation can be found at
<https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-systemtimetotzspecificlocaltimeex>
and
<https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-tzspecificlocaltimetosystemtimeex>.

Note that because these functions currently outright abort, the work-around I
implemented requires explicitly detecting Wine and not even trying to call
them, which is far from optimal.

Even just implementing stubs that always fail gracefully instead of just
aborting the whole process would be much appreciated.

This came up when improving local timezone handling in OpenMPT. See
<https://bugs.openmpt.org/view.php?id=1618> and
<https://source.openmpt.org/browse/openmpt?op=comp&compare[]=/trunk/OpenMPT/@17667&compare[]=/trunk/OpenMPT/@17668>.


Simple test case (for SystemTimeToTzSpecificLocalTimeEx):

tz.cpp:
```
#include <iostream>
#include <stdexcept>

#include <windows.h>

int main() {
    try {
        SYSTEMTIME sys{};
        GetSystemTime(&sys);
        DYNAMIC_TIME_ZONE_INFORMATION dtzi{};
        if (GetDynamicTimeZoneInformation(&dtzi) == TIME_ZONE_ID_INVALID) {
            throw std::runtime_error("GetDynamicTimeZoneInformation()
failed.");
        }
        SYSTEMTIME sys_local{};
        if (SystemTimeToTzSpecificLocalTimeEx(&dtzi, &sys, &sys_local) ==
FALSE) {
            throw std::runtime_error("SystemTimeToTzSpecificLocalTimeEx()
failed.");
        }
        std::cout << "OK" << std::endl;
        return 0;
    } catch (const std::exception & e) {
        std::cout << std::flush;
        std::cerr << e.what() << std::endl;
        std::cerr << std::flush;
    }
    std::cout << "FAIL" << std::endl;
    return 1;
}
```
built with VS2022 by running `cl /std:c++20 /permissive- /EHsc /O2 /W4 tz.cpp`
results in
```
wine: Call from 0x7bc7c990 to unimplemented function
KERNEL32.dll.SystemTimeToTzSpecificLocalTimeEx, aborting
```
not even reaching the FAIL output. tz.exe attached.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list