wcsftime(3C)wcsftime(3C)NAMEwcsftime - convert date and time to wide character string
SYNOPSIS
#include <wchar.h>
XPG4
size_t wcsftime (char *wcs, size_t maxsize, const char *format,
const struct tm *timeptr);
XPG5
size_t wcsftime (char *wcs, size_t maxsize, const wchar_t *format,
const struct tm *timeptr);
DESCRIPTIONwcsftime places wide-character codes into the array pointed to by wcs as
controlled by the string or the wide character string pointed to by
format. The format string or wide character string consists of zero or
more directives and ordinary characters. All ordinary characters
(including the terminating null character) are copied unchanged into the
array. For wcsftime, no more than maxsize characters are placed into the
array.
This function behaves as if the character string generated by strftime is
passed to mbstowcs as the character string argument, and mbstowcs places
the result in the wide character string argument of wcsftime up to a
limit of maxsize wide-character codes.
RETURN VALUE
If the total number of resulting wide character codes including the
terminating null wide-character code is no more than maxsize , wcsftime
returns the number of wide-character codes placed into the array pointed
to by wcs , not including the terminating null wide-character code.
Otherwise 0 is returned and the contents of the array are indeterminate.
If the function is not implemented, errno will be set to indicate the
error.
SEE ALSOstrftime(3C), strftime(4), mbstowcs(3C), <wchar.h>.
NOTES
There are two types of wcsftime functions in n32 and 64 bit C libraries
for IRIX 6.5.17 and later versions. One is XPG4 type which has been in C
library, and another is XPG5 type function. The difference is a third
argument type, which is const char *format for XPG4 and const wchar_t
*format for XPG5. Old programs calling wcsftime function have XPG4
behavior of the function for backward compatibility. When XPG5 behavior
is required, new programs must be compiled with the wchar.h header file
and _XOPEN_SOURCE set to 500. XPG5 type function is not supported in o32
C library.
The XPG5 type wcsftime function is actually defined as a static inline
function in wchar_core.h, and it calls a new function _xpg5_wcsftime
which is specific to IRIX 6.5.17 and later. Therefore applications that
Page 1
wcsftime(3C)wcsftime(3C)
call XPG5 type wcsftime should check the existence of the new symbol.
#include <wchar.h>
#include <optional_sym.h>
if (_MIPS_SYMBOL_PRESENT(_xpg5_wcsftime)) {
wcsftime(wcs, maxsize, wcs_format, timeptr);
} else {
...
}
Because the static inline function is defined in each source file that
includes wchar.h, these static functions will have different addresses in
any cases that inline expansion is not performed. This may cause problems
if the address of the function is examined in programs. To avoid this
problem, use -D_XPG5_WCSFTIME_USER_DEFINED compile option to disable the
static inline definition in wchar_core.h, and define a user defined
function with below definition:
size_t
wcsftime(wchar_t *_wcs, size_t _maxsize, const wchar_t *_format, const struct tm *_timptr)
{
return(_xpg5_wcsftime(_wcs, _maxsize, _format, _timptr));
}
Use the compile option always, when a user defined XPG5 wcsftime function
is required.
Page 2