From 3c4becbe18f924eee51b4ffba632485d90728264 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 9 Mar 2009 12:35:03 +0000 Subject: * libc/time/strftime.c: Adapt for dual-purpose use so not only defines strftime(), but can also define wcsftime(); add optional test package; speed up %Y handling. * libc/time/wcsftime.c: New file, defining wcsftime() (albeit indirectly by including strftime.c) and its documentation. * libc/time/time.tex: Enhance tm_isdst explanation, change strftime description to match modified description in strftime.c * libc/time/Makefile.am: Add wcsftime.c and wcsftime.def. Add a rule so that wcsftime.o gets rebuilt when strftime changes. * libc/time/Makefile.in: Regenerate. * libc/include/wchar.h (wcsftime): Declare. --- newlib/libc/time/wcsftime.c | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 newlib/libc/time/wcsftime.c (limited to 'newlib/libc/time/wcsftime.c') diff --git a/newlib/libc/time/wcsftime.c b/newlib/libc/time/wcsftime.c new file mode 100644 index 000000000..323a6c2eb --- /dev/null +++ b/newlib/libc/time/wcsftime.c @@ -0,0 +1,64 @@ +/* + * wcsftime.c + * Original Author: Craig Howland, for Newlib + * + * Source actually uses strftime.c. + * Documentation for wcsftime() here, with minimal overlap. + */ + +/* +FUNCTION +<>--convert date and time to a formatted wide-character string + +INDEX + wcsftime + +ANSI_SYNOPSIS + #include + #include + size_t wcsftime(wchar_t *<[s]>, size_t <[maxsize]>, + const wchar_t *<[format]>, const struct tm *<[timp]>); + +DESCRIPTION +<> is equivalent to <>, except that: + +The argument s points to the initial element of an array of wide characters +into which the generated output is to be placed. + +The argument maxsize indicates the limiting number of wide characters. + +The argument format is a wide-character string and the conversion specifiers +are replaced by corresponding sequences of wide characters. + +The return value indicates the number of wide characters. + +See <> for the details of the format specifiers. + +RETURNS +When the formatted time takes up no more than <[maxsize]> wide characters, +the result is the length of the formatted wide string. Otherwise, if the +formatting operation was abandoned due to lack of room, the result is +<<0>>, and the wide-character string starting at <[s]> corresponds to just those +parts of <<*<[format]>>> that could be completely filled in within the +<[maxsize]> limit. + +PORTABILITY +C99 and POSIX require <>, but do not specify the contents of +<<*<[s]>>> when the formatted string would require more than +<[maxsize]> characters. Unrecognized specifiers and fields of +<> that are out of range cause undefined results. Since some +formats expand to 0 bytes, it is wise to set <<*<[s]>>> to a nonzero +value beforehand to distinguish between failure and an empty string. +This implementation does not support <> being NULL, nor overlapping +<> and <>. + +SEEALSO +<> + +<> requires no supporting OS subroutines. +*/ + +#include +#include +#define MAKE_WCSFTIME +#include "../time/strftime.c" -- cgit v1.2.3