Function _difftime64 is available since msvcr80.dll and in system os
msvcrt.dll since Windows Vista.
For older msvcrt versions provide very simple mingw-w64 emulation of import
_difftime64 symbol.
---
mingw-w64-crt/Makefile.am | 2 ++
mingw-w64-crt/lib-common/msvcrt.def.in | 2 +-
mingw-w64-crt/misc/_difftime64.c | 18 ++++++++++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 mingw-w64-crt/misc/_difftime64.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 1ee1ae57b62a..99cccab61770 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -573,6 +573,7 @@ src_msvcrt32=\
misc/_aligned_offset_realloc.c \
misc/_aligned_realloc.c \
misc/_create_locale.c \
+ misc/_difftime64.c \
misc/_free_locale.c \
misc/_ftime64.c \
misc/_get_current_locale.c \
@@ -916,6 +917,7 @@ src_pre_msvcr80=\
misc/_aligned_offset_recalloc.c \
misc/_aligned_recalloc.c \
misc/_configthreadlocale.c \
+ misc/_difftime64.c \
misc/_get_daylight.c \
misc/_get_doserrno.c \
misc/_get_dstbias.c \
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in
b/mingw-w64-crt/lib-common/msvcrt.def.in
index e597adad5efe..a1adeee91ac0 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1395,7 +1395,7 @@ _cwscanf_l
_cwscanf_s
_cwscanf_s_l
_difftime32 F_I386(== difftime) ; i386 _difftime32 replaced by alias
-_difftime64 F_X64(== difftime) ; x64 _difftime64 replaced by alias
+F_NON_I386(_difftime64 F_X64(== difftime)) ; i386 _difftime64 replaced by emu
and x64 _difftime64 replaced by alias
_ecvt_s
F_I386(_except_handler4_common)
_expand_dbg
diff --git a/mingw-w64-crt/misc/_difftime64.c b/mingw-w64-crt/misc/_difftime64.c
new file mode 100644
index 000000000000..7ae15286f8ec
--- /dev/null
+++ b/mingw-w64-crt/misc/_difftime64.c
@@ -0,0 +1,18 @@
+/**
+ * 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>
+
+static double __cdecl emu__difftime64(__time64_t _Time1, __time64_t _Time2)
+{
+ return (double)(_Time1 - _Time2);
+}
+
+#define RETT double
+#define FUNC _difftime64
+#define ARGS __time64_t _Time1, __time64_t _Time2
+#define CALL _Time1, _Time2
+#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