Rename two directories: headers -> posix-headers, functions -> posix-functions.
[gnulib.git] / doc / posix-functions / ctime_r.texi
1 @node ctime_r
2 @section @code{ctime_r}
3 @findex ctime_r
4
5 POSIX specification: @url{http://www.opengroup.org/susv3xsh/ctime_r.html}
6
7 Gnulib module: ---
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @end itemize
12
13 Portability problems not fixed by Gnulib:
14 @itemize
15 @item
16 This function is missing on some platforms:
17 mingw.
18 @item
19 This function may put more than 26 bytes into the argument buffer if an
20 invalid year is passed.
21 @end itemize
22
23 @code{ctime_r} takes a pre-allocated buffer and length of the buffer,
24 and returns @code{NULL} on errors.
25 The input buffer should be at least 26 bytes in size.  The output
26 string is locale-independent.  However, years can have more than 4
27 digits if @code{time_t} is sufficiently wide, so the length of the
28 required output buffer is not easy to determine.  Increasing the
29 buffer size when @code{ctime_r} returns @code{NULL} is not necessarily
30 sufficient.  The @code{NULL} return value could mean some other error
31 condition, which will not go away by increasing the buffer size.
32
33 A more flexible function is @code{strftime}.  However, note that it is
34 locale dependent.