1 /* Copyright (c) 2009 Craig Howland */ 2 /* 3 * wcsftime.c 4 * Original Author: Craig Howland, for Newlib 5 * 6 * Source actually uses strftime.c. 7 * Documentation for wcsftime() here, with minimal overlap. 8 */ 9 10 /* 11 FUNCTION 12 <<wcsftime>>---convert date and time to a formatted wide-character string 13 14 INDEX 15 wcsftime 16 17 SYNOPSIS 18 #include <time.h> 19 #include <wchar.h> 20 size_t wcsftime(wchar_t *<[s]>, size_t <[maxsize]>, 21 const wchar_t *<[format]>, const struct tm *<[timp]>); 22 23 DESCRIPTION 24 <<wcsftime>> is equivalent to <<strftime>>, except that: 25 26 O+ 27 o The argument s points to the initial element of an array of wide characters 28 into which the generated output is to be placed. 29 30 o The argument maxsize indicates the limiting number of wide characters. 31 32 o The argument format is a wide-character string and the conversion specifiers 33 are replaced by corresponding sequences of wide characters. 34 35 o The return value indicates the number of wide characters. 36 O- 37 (The difference in all of the above being wide characters versus regular 38 characters.) 39 40 See <<strftime>> for the details of the format specifiers. 41 42 RETURNS 43 When the formatted time takes up no more than <[maxsize]> wide characters, 44 the result is the length of the formatted wide string. Otherwise, if the 45 formatting operation was abandoned due to lack of room, the result is 46 <<0>>, and the wide-character string starting at <[s]> corresponds to just those 47 parts of <<*<[format]>>> that could be completely filled in within the 48 <[maxsize]> limit. 49 50 PORTABILITY 51 C99 and POSIX require <<wcsftime>>, but do not specify the contents of 52 <<*<[s]>>> when the formatted string would require more than 53 <[maxsize]> characters. Unrecognized specifiers and fields of 54 <<timp>> that are out of range cause undefined results. Since some 55 formats expand to 0 bytes, it is wise to set <<*<[s]>>> to a nonzero 56 value beforehand to distinguish between failure and an empty string. 57 This implementation does not support <<s>> being NULL, nor overlapping 58 <<s>> and <<format>>. 59 60 <<wcsftime>> requires no supporting OS subroutines. 61 62 SEEALSO 63 <<strftime>> 64 */ 65 66 #define _DEFAULT_SOURCE 67 #include <time.h> 68 #include <wchar.h> 69 #define MAKE_WCSFTIME 70 #include "../time/strftime.c" 71