view doc/posix-functions/ctime_r.texi @ 39913:73d60b1f9c96

doc: Update for Solaris 11.4. * doc/**/*.texi: For bugs that exist in both Solaris 11.3 and 11.4, mention Solaris 11.4. * m4/printf.m4: Update comments about Solaris. * m4/log.m4: Likewise. * m4/log10.m4: Likewise. * m4/logb.m4: Likewise. * m4/logbf.m4: Likewise. * m4/logbl.m4: Likewise. * m4/rename.m4: Likewise. * m4/wcrtomb.m4: Likewise. * m4/hostent.m4: Likewise. * m4/servent.m4: Likewise.
author Bruno Haible <bruno@clisp.org>
date Sun, 14 Oct 2018 09:33:46 +0200
parents 11af6bbd6df5
children
line wrap: on
line source

@node ctime_r
@section @code{ctime_r}
@findex ctime_r

POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/ctime_r.html}

Gnulib module: extensions

Portability problems fixed by Gnulib:
@itemize
@item
This function has an incompatible declaration on some platforms:
Solaris 11.4 (when @code{_POSIX_PTHREAD_SEMANTICS} is not defined).
@end itemize

Portability problems not fixed by Gnulib:
@itemize
@item
This function is missing on some platforms:
mingw, MSVC 14.
@item
This function may put more than 26 bytes into the argument buffer if an
invalid year is passed.
@end itemize

@code{ctime_r} takes a pre-allocated buffer and length of the buffer,
and returns @code{NULL} on errors.
The input buffer should be at least 26 bytes in size.  The output
string is locale-independent.  However, years can have more than 4
digits if @code{time_t} is sufficiently wide, so the length of the
required output buffer is not easy to determine.  Increasing the
buffer size when @code{ctime_r} returns @code{NULL} is not necessarily
sufficient.  The @code{NULL} return value could mean some other error
condition, which will not go away by increasing the buffer size.

A more flexible function is @code{strftime}.  However, note that it is
locale dependent.