Is this a Wine bug, or a Windows bug?

Keith Marshall <[email protected]> Wed, 13 May 2020 14:16:44 +0100
Newsgroups gmane.comp.gnu.mingw.user
Organization MinGW.org Project
Message-ID <[email protected]>
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

[1]:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2019
says that the "%z" format spec represents the ISO-8601 timezone offset
from UTC, which is exactly what the a.out build displays; the output of
"GMT Daylight Time" would be okay for "%Z", (and indeed that's just what
"%Z" yields too), but it's not correct for "%z".

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

_______________________________________________
MinGW-Users mailing list
[email protected]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEwZ7AGBVH3lDh1I9TwK02xjR+Wj8FAl678z0ACgkQwK02xjR+
Wj/XjBAAv2wGyylii63JB5JyM63EdDRcxSW+3pFHS5+JDj+qmvxbg5SHXMXHn2R6
VTz30pKCzMlWbgonTBIJ2QjmHlK5t1KtMneuEEha8203RpvD+SuizQ8KhEs8osgw
sg3tBA1SPwPhAWNMkWZ0Omqk+wzcnW/DIlnJxiNolX9Jta7Hwswt4PkKvMm2fJld
wI/1Q6B0wp3JAx5atrb+YEFG5sDGiNCg0h53wybwB7qwQ0PrMxImGJvuxfL2N7El
wbGkz8woQe/4tF9WoVEDZY0LALiowAHE9TPcmNqiP6n+dKbz2fvLyukI9BEO7nh9
pYoF3JQesDsNXC+kDnAONPautqF9u1IB7V1RnijlNByvrbL3U1mmpRS/Hn4IUz77
3foeK/XrvpIpkuxFFk6AjA2Z1IPQUleKE0hV0G/T3RZndCNIlFl6OpYo/vh0o+4G
zH4Kw1PtuM7NDKKkdo9JZHAhnztGKwuSGnWMGmRV7vHQc1bwdhgSKA/IIx7uLqdU
pWeXbERJAgq2/KUhRiNLt0eNbFl5X0L4E4+XN51nLVn+IpWMijkUfuepYnrUxXvm
7jEsghSQyUo+UqHFSA9ep10Hlj05NE1Ng5pZ973Zv1wsCJOvZzFitzWwkzYfucVS
jTuiEhX3iyOszWVvdTchnxRgzOxnNLzAS/ieJ4OVb/3ITgiZdUk=
=jOlC
-----END PGP SIGNATURE-----