poll tests: Avoid test failure on BSD and Solaris systems.
[gnulib.git] / doc / posix-functions / ctime.texi
blobd9e194c2b3ef5dac210640a98ed4689e169aa3fe
1 @node ctime
2 @section @code{ctime}
3 @findex ctime
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html}
7 Gnulib module: ctime
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 On native Windows platforms (mingw, MSVC), this function works incorrectly
13 when the environment variable @code{TZ} has been set by Cygwin.
14 @end itemize
16 Portability problems not fixed by Gnulib:
17 @itemize
18 @item
19 This function may overflow its internal buffer if an invalid year is passed.
20 @item
21 The @code{ctime} function need not be reentrant, and consequently is
22 not required to be thread safe.  Implementations of @code{ctime}
23 typically write the timestamp into static buffer.  If two threads
24 call @code{ctime} at roughly the same time, you might end up with the
25 wrong date in one of the threads, or some undefined string.  There is
26 a re-entrant interface @code{ctime_r}.
27 @item
28 Native Windows platforms (mingw, MSVC) support only a subset of time
29 zones supported by GNU or specified by POSIX@.  @xref{tzset}.
30 @end itemize
32 A more flexible function is @code{strftime}.  However, note that it is
33 locale dependent.