As a first step, let me document this for the POSIX functions.
2017-04-30 Bruno Haible <br...@clisp.org> Document the problem with the Cygwin environment variable TZ. * doc/posix-functions/tzset.texi: Add note about TZ. * doc/posix-functions/ctime.texi: Likewise. * doc/posix-functions/localtime.texi: Likewise. * doc/posix-functions/mktime.texi: Likewise. * doc/posix-functions/strftime.texi: Likewise. * doc/posix-functions/wcsftime.texi: Likewise. * doc/pastposix-functions/ftime.texi: Likewise. diff --git a/doc/pastposix-functions/ftime.texi b/doc/pastposix-functions/ftime.texi index 0fcaed1..582a088 100644 --- a/doc/pastposix-functions/ftime.texi +++ b/doc/pastposix-functions/ftime.texi @@ -16,6 +16,9 @@ Portability problems not fixed by Gnulib: This function is missing on some platforms: Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, IRIX 5.3, Solaris 2.4. @item +On native Windows platforms (mingw, MSVC), this function works incorrectly +when the environment variable @code{TZ} has been set by Cygwin. +@item This function is marked as ``legacy'' in POSIX. Better use @code{gettimeofday} or @code{clock_gettime} instead, and use @code{ftime} only as a fallback for portability to Windows platforms. diff --git a/doc/posix-functions/ctime.texi b/doc/posix-functions/ctime.texi index f5a7c27..e54a7b5 100644 --- a/doc/posix-functions/ctime.texi +++ b/doc/posix-functions/ctime.texi @@ -13,6 +13,9 @@ Portability problems fixed by Gnulib: Portability problems not fixed by Gnulib: @itemize @item +On native Windows platforms (mingw, MSVC), this function works incorrectly +when the environment variable @code{TZ} has been set by Cygwin. +@item This function may overflow its internal buffer if an invalid year is passed. @item The @code{ctime} function need not be reentrant, and consequently is diff --git a/doc/posix-functions/localtime.texi b/doc/posix-functions/localtime.texi index 49a6ddd..1d6acdb 100644 --- a/doc/posix-functions/localtime.texi +++ b/doc/posix-functions/localtime.texi @@ -12,7 +12,11 @@ Portability problems fixed by Gnulib: Portability problems not fixed by Gnulib: @itemize -@item On some platforms, this function returns nonsense values for +@item +On native Windows platforms (mingw, MSVC), this function works incorrectly +when the environment variable @code{TZ} has been set by Cygwin. +@item +On some platforms, this function returns nonsense values for unsupported arguments (like @math{2^56}), rather than failing: FreeBSD 10. @end itemize diff --git a/doc/posix-functions/mktime.texi b/doc/posix-functions/mktime.texi index 9756948..ffb7b79 100644 --- a/doc/posix-functions/mktime.texi +++ b/doc/posix-functions/mktime.texi @@ -16,4 +16,7 @@ Portability problems fixed by Gnulib: Portability problems not fixed by Gnulib: @itemize +@item +On native Windows platforms (mingw, MSVC), this function works incorrectly +when the environment variable @code{TZ} has been set by Cygwin. @end itemize diff --git a/doc/posix-functions/strftime.texi b/doc/posix-functions/strftime.texi index e58e1ef..d371818 100644 --- a/doc/posix-functions/strftime.texi +++ b/doc/posix-functions/strftime.texi @@ -13,6 +13,9 @@ Portability problems fixed by Gnulib: Portability problems not fixed by Gnulib: @itemize @item +On native Windows platforms (mingw, MSVC), this function works incorrectly +when the environment variable @code{TZ} has been set by Cygwin. +@item The Windows C runtime library (which is used by MinGW) does not support the %e specifier (and possibly the other more recent SUS specifiers too, i.e., %C, %D, %h, %n, %r, %R, %t, and %T). diff --git a/doc/posix-functions/tzset.texi b/doc/posix-functions/tzset.texi index 35fc509..30b147c 100644 --- a/doc/posix-functions/tzset.texi +++ b/doc/posix-functions/tzset.texi @@ -16,4 +16,7 @@ Solaris 2.6. Portability problems not fixed by Gnulib: @itemize +@item +On native Windows platforms (mingw, MSVC), this function works incorrectly +when the environment variable @code{TZ} has been set by Cygwin. @end itemize diff --git a/doc/posix-functions/wcsftime.texi b/doc/posix-functions/wcsftime.texi index 0faa211..8ab82c2 100644 --- a/doc/posix-functions/wcsftime.texi +++ b/doc/posix-functions/wcsftime.texi @@ -16,6 +16,9 @@ Portability problems not fixed by Gnulib: This function is missing on some platforms: OpenBSD 3.8, Minix 3.1.8, IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x, BeOS. @item +On native Windows platforms (mingw, MSVC), this function works incorrectly +when the environment variable @code{TZ} has been set by Cygwin. +@item On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize