This seems logical that if we provide those, we should define it. That's
also a clean way for applications to test for
_POSIX_THREAD_SAFE_FUNCTIONS to detect presence of related functions.

---
 mingw-w64-headers/crt/time.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index 7b43fd8..4ff1b14 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -261,7 +261,11 @@ struct timezone {
 
 #pragma pack(pop)
 
-#if defined(_POSIX_C_SOURCE) || defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+#if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
+#endif
+
+#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
 __forceinline struct tm *__cdecl localtime_r(const time_t *_Time, struct tm *_Tm) {
   return localtime_s(_Tm, _Time) ? NULL : _Tm;
 }
@@ -274,7 +278,7 @@ __forceinline char *__cdecl ctime_r(const time_t *_Time, char *_Str) {
 __forceinline char *__cdecl asctime_r(const struct tm *_Tm, char * _Str) {
   return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
 }
-#endif /* _POSIX_C_SOURCE */
+#endif
 
 /* Adding timespec definition.  */
 #include <sys/timeb.h>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to