summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2019-10-28 23:53:09 +0200
committerMartin Storsjö <martin@martin.st>2020-01-14 22:29:47 +0200
commit337e4359645ebd0f35136dbec9b51c48b9071f9c (patch)
tree9f35699f7d157ca1db05d1cf1e676ec164adb3dd /libcxx/src
parent26d96126a0d258afccfeec1fbaa727bfeb820308 (diff)
[libcxx] [Windows] Make a more proper implementation of strftime_l for mingw with msvcrt.dll
This also makes this function consistent with the rest of the libc++ provided fallbacks. The locale support in msvcrt.dll is very limited anyway; it can only be configured processwide, not per thread, and it only seems to support the locales "C" and "" (the user set locale), so it's hard to make any meaningful automatic test for it. But manually tested, this change does make time formatting locale code in libc++ output times in the user requested format, when using locale "". Differential Revision: https://reviews.llvm.org/D69554
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/support/win32/locale_win32.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libcxx/src/support/win32/locale_win32.cpp b/libcxx/src/support/win32/locale_win32.cpp
index ee3a4306d9ef..a64788685c22 100644
--- a/libcxx/src/support/win32/locale_win32.cpp
+++ b/libcxx/src/support/win32/locale_win32.cpp
@@ -127,3 +127,11 @@ long double strtold_l(const char* nptr, char** endptr, locale_t loc) {
return strtold(nptr, endptr);
}
#endif
+
+#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
+size_t strftime_l(char *ret, size_t n, const char *format, const struct tm *tm,
+ locale_t loc) {
+ __libcpp_locale_guard __current(loc);
+ return strftime(ret, n, format, tm);
+}
+#endif