---
 mingw-w64-crt/Makefile.am              |  1 +
 mingw-w64-crt/lib-common/msvcrt.def.in |  2 +-
 mingw-w64-crt/misc/_time32.c           | 24 ++++++++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 mingw-w64-crt/misc/_time32.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 1e6d344bd40a..52bc0d950c23 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -679,6 +679,7 @@ src_msvcrt64=\
   misc/output_format.c \
   misc/_get_errno.c \
   misc/_set_errno.c \
+  misc/_time32.c \
   misc/strnlen.c \
   misc/wassert.c \
   misc/wcsnlen.c \
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in 
b/mingw-w64-crt/lib-common/msvcrt.def.in
index 9caf981ac30c..b13a218e4ccf 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1673,7 +1673,7 @@ _swprintf_s_l
 _swscanf_l
 _swscanf_s_l
 _tempnam_dbg
-_time32 F_I386(== time) ; i386 _time32 replaced by alias
+F_NON_X64(_time32 F_I386(== time)) ; i386 _time32 replaced by alias and x64 
_time32 replaced by emu
 _tolower_l
 _toupper_l
 _towlower_l
diff --git a/mingw-w64-crt/misc/_time32.c b/mingw-w64-crt/misc/_time32.c
new file mode 100644
index 000000000000..1855ee225780
--- /dev/null
+++ b/mingw-w64-crt/misc/_time32.c
@@ -0,0 +1,24 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include <time.h>
+#include <stdint.h>
+
+static __time32_t __cdecl emu__time32(__time32_t *timeptr)
+{
+    __time64_t time64 = _time64(NULL);
+    if (time64 > INT32_MAX)
+        time64 = -1;
+    if (timeptr)
+        *timeptr = (__time32_t)time64;
+    return (__time32_t)time64;
+}
+
+#define RETT __time32_t
+#define FUNC _time32
+#define ARGS __time32_t *timeptr
+#define CALL timeptr
+#include "msvcrt_or_emu_glue.h"
-- 
2.20.1



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

Reply via email to