[Mingw-users] Is this a Wine bug, or a Windows bug?

Back to archive index
Eli Zaretskii eliz****@gnu*****
Thu May 14 00:21:18 JST 2020


> From: Keith Marshall <keith****@users*****>
> Date: Wed, 13 May 2020 14:16:44 +0100
> 
> I suspect that it's probably the former, but I no longer have ready
> access to a Windows host, on which to test.  The following toy program:
> 
>   #include <time.h>
>   #include <stdio.h>
> 
>   #ifdef _WIN32
>   #define localtime _localtime64
>   #endif
> 
>   int main()
>   {
>     struct timespec now;
>     if( clock_gettime( CLOCK_REALTIME, &now ) == 0 )
>     {
>       char buf[64];
>       if( strftime( buf, sizeof buf, "%Y-%m-%d %H:%M %z",
>           localtime( &now.tv_sec ) )
>         != 0 )
>           printf( "%s\n", buf );
>     }
>     return 0;
>   }
> 
> when cross-compiled, and run under wine-5.7, results in output which is
> similar to:
> 
>   $ mingw32-gcc foo.c
>   $ ./a.exe
>   2020-05-13 13:46 GMT Daylight Time
> 
> whereas the expected, and correct[1], output would be similar to:
> 
>   $ gcc foo.c
>   $ ./a.out
>   2020-05-13 13:46 +0100

No, it's a Windows bug in MSVCRT; wine just mimics it.

First, I get the same output on my genuine Windows XP SP3 system
(modulo a different name of the time zone).  And second, the MSVCRT
sources clearly show that %Z and %z are treated in exactly the same
way.

I will try to test this in a newer version of Windows, maybe this was
fixed in a later version of MSVCRT.



More information about the MinGW-Users mailing list
Back to archive index