When building GCC for msvcrt120, there's a undefined reference to
ctime. It needs to be defined as a wrapper for msvcrt120 as well.
The if condition is slightly complex, but I do not know if I can
modify the if !defined(__CRT__NO_INLINE) || __MSVCRT_VERSION__ >= 0x1400
block instead: This would also change difftime, localtime and so on and
I'm not sure if these should be changed.

Best regards,
Johannes

---
 mingw-w64-headers/crt/time.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index 73f6264a..7eee34c6 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -216,7 +216,6 @@ extern "C" {
 #ifndef RC_INVOKED
 #if __MSVCRT_VERSION__ < 0x1400
 double __cdecl difftime(time_t _Time1,time_t _Time2);
-char *__cdecl ctime(const time_t *_Time) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
 struct tm *__cdecl gmtime(const time_t *_Time) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
 struct tm *__cdecl localtime(const time_t *_Time) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
 
@@ -224,6 +223,9 @@ time_t __cdecl mktime(struct tm *_Tm);
 time_t __cdecl _mkgmtime(struct tm *_Tm);
 time_t __cdecl time(time_t *_Time);
 #endif
+#if __MSVCRT_VERSION__ < 0x1200
+char *__cdecl ctime(const time_t *_Time) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+#endif
 
 #if !defined(__CRT__NO_INLINE) || __MSVCRT_VERSION__ >= 0x1400
 #if __MSVCRT_VERSION__ >= 0x1400
@@ -252,6 +254,14 @@ __TIME_INLINE time_t __cdecl time(time_t *_Time) { return 
_time32(_Time); }
 #endif /* !_USE_32BIT_TIME_T */
 #endif /* !__CRT__NO_INLINE */
 
+#if defined(__CRT__NO_INLINE) && __MSVCRT_VERSION__ >= 0x1200 && 
__MSVCRT_VERSION__ < 0x1400
+#if !defined(_USE_32BIT_TIME_T)
+__mingw_static_ovr char *__cdecl ctime(const time_t *_Time) { return 
_ctime64(_Time); }
+#else
+__mingw_static_ovr char *__cdecl ctime(const time_t *_Time) { return 
_ctime32(_Time); }
+#endif
+#endif
+
 #ifdef _USE_32BIT_TIME_T
 __forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) 
{ return _localtime32_s(_Tm,_Time); }
 __forceinline errno_t __cdecl gmtime_s(struct tm *_Tm, const time_t *_Time)   
{ return _gmtime32_s(_Tm, _Time); }
-- 
2.19.2



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to