Function _time64 is avaulable since msvcr70.dll. For older msvcrt versions
provide emulation via WinAPI GetSystemTime() function which is available on
all Windows versions and returns native value in SYSTEMTIME format.
---
mingw-w64-crt/Makefile.am | 2 ++
mingw-w64-crt/lib-common/msvcrt.def.in | 2 +-
mingw-w64-crt/misc/_time64.c | 31 ++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 mingw-w64-crt/misc/_time64.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index c849a85b3a1a..88e668746b22 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -513,6 +513,7 @@ src_msvcrt32=\
misc/_free_locale.c \
misc/_get_current_locale.c \
misc/_initterm_e.c \
+ misc/_time64.c \
misc/btowc.c \
misc/imaxabs.c \
misc/lc_locale_func.c \
@@ -787,6 +788,7 @@ src_pre_msvcr70=\
misc/___mb_cur_max_func.c \
misc/__pctype_func.c \
misc/__pwctype_func.c \
+ misc/_time64.c \
misc/lc_locale_func.c \
misc/strtoimax.c \
misc/strtoumax.c \
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in
b/mingw-w64-crt/lib-common/msvcrt.def.in
index afc6092f5bdc..c989f6c3fa36 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1161,7 +1161,7 @@ _localtime64
_mktime64
F_X86_ANY(_osplatform DATA)
F_NON_I386(_stat64) ; i386 _stat64 replaced by emu
-_time64
+F_NON_I386(_time64) ; i386 _time64 replaced by emu
_utime64
_wctime64
_wfindfirst64
diff --git a/mingw-w64-crt/misc/_time64.c b/mingw-w64-crt/misc/_time64.c
new file mode 100644
index 000000000000..0eb9a9988a2d
--- /dev/null
+++ b/mingw-w64-crt/misc/_time64.c
@@ -0,0 +1,31 @@
+/**
+ * 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 <windows.h>
+#include <time.h>
+
+#include "filetime_to_time64.h"
+
+static __time64_t __cdecl emu__time64(__time64_t *timeptr)
+{
+ SYSTEMTIME systemtime;
+ FILETIME filetime;
+ __time64_t time64;
+ GetSystemTime(&systemtime);
+ if (SystemTimeToFileTime(&systemtime, &filetime))
+ time64 = filetime_to_time64(&filetime);
+ else
+ time64 = -1;
+ if (timeptr)
+ *timeptr = time64;
+ return time64;
+}
+
+#define RETT __time64_t
+#define FUNC _time64
+#define ARGS __time64_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