Zhongteng Gui <[email protected]> wrote: > On 2026/09/05 11:03, Kirill Makurin wrote: >> Zhongteng Gui <[email protected]> wrote: >> >>> 1. Originally, we provide `int gettimeofday(struct timeval*, void*)`, while >>> POSIX expects `int gettimeofday(struct timeval*, struct timezone*)`. It's >>> noteworthy that switching to POSIX will breaks GCC without special handling. >>> because libiberty.h bundled by GCC specially checked for __MINGW32__, and >>> declares gettimeofday with `void*` arg type, which fails with >>> -Wstrict-prototypes. But keeping `void*` is semantically wrong, as we >>> actually >>> set timezone if nonnull. >> >> Are you sure? 2018 edition of POSIX specification[1] declares it as `int >> gettimeofday(struct timeval *restrict tp, void *restrict tzp)`. >> >> It also says: >> >> ``` >> If tzp is not a null pointer, the behavior is unspecified. >> ``` >> >> And so, POSIX says nothing about `struct timezone`, what it is and how to >> use it. > > I got the impression from > https://www.man7.org/linux/man-pages/man2/gettimeofday.2.html
I had this happen to me a few times as well. These man pages describe Linux behavior and may sometimes disagree with POSIX specification. OTOH, there are also man pages which describe POSIX behavior instead. You can easily distinguish them: Linux ones have "Library Functions Manual" at the header. > Seemes that POSIX uses `void*`, while glibc uses `struct timezone*`. I think many historical systems (Unix, BSDs, Linux) are likely to have `struct timezone*` because they actually used it in one way or another, or simply were following older versions of POSIX. - Kirill Makurin _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
