summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-07-24 18:05:27 -0400
committerRich Felker <dalias@aerifal.cx>2013-07-24 18:05:27 -0400
commitcccf64e281026a06ba03c1d4157237013e763ad2 (patch)
tree80363cb21974bb79f42a2ff83e75a482b6e18f82 /src
parent0a37d99547b2a82880cdf8dd849f98ed39d179e1 (diff)
downloadmusl-cccf64e281026a06ba03c1d4157237013e763ad2.tar.gz
add __wcsftime_l symbol
unlike the strftime commit, this one is purely an ABI compatibility issue. the previous version of the code would have worked just as well with LC_TIME once LC_TIME support is added.
Diffstat (limited to 'src')
-rw-r--r--src/time/wcsftime.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/time/wcsftime.c b/src/time/wcsftime.c
index da6c1f8a..7b631f5f 100644
--- a/src/time/wcsftime.c
+++ b/src/time/wcsftime.c
@@ -1,8 +1,11 @@
#include <wchar.h>
#include <time.h>
#include <string.h>
+#include <locale.h>
-size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm)
+size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t);
+
+size_t __wcsftime_l(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
{
size_t k, n0=n;
char out[100], in[4];
@@ -17,7 +20,7 @@ size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, cons
in[0] = *f++;
if (strchr("EO", (in[1]=*f++)))
in[2] = *f++;
- k = strftime(out, sizeof out, in, tm);
+ k = __strftime_l(out, sizeof out, in, tm, loc);
if (!k) return 0;
k = mbsrtowcs(wcs, (const char *[]){out}, n, 0);
if (k==(size_t)-1) return 0;
@@ -29,4 +32,7 @@ size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, cons
return n0-n;
}
-
+size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm)
+{
+ return __wcsftime_l(wcs, n, f, tm, LC_GLOBAL_LOCALE);
+}