Use correct prototype for _difftime32 & _difftime64.

Note that time.h already uses the correct prototype.

Question: Could the intent here have been to treat the (normally) signed __time32_t as unsigned in an attempt to squeeze more life out of it (the '2038' problem)? If so, 'tricking' the compiler by having mismatched headers seems the wrong way to achieve this. Not to mention that this approach has other problems (https://en.wikipedia.org/wiki/Year_2038_problem#Solutions).

dw

diff --git a/mingw-w64-crt/misc/difftime32.c b/mingw-w64-crt/misc/difftime32.c
index 9eb3ecf..b893944 100644
--- a/mingw-w64-crt/misc/difftime32.c
+++ b/mingw-w64-crt/misc/difftime32.c
@@ -1,8 +1,8 @@
-double _difftime32(unsigned int _Time1,unsigned int _Time2);
+#include <time.h>
 
-double _difftime32(unsigned int _Time1,unsigned int _Time2)
+double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2)
 {
-  unsigned int r = _Time1 - _Time2;
+  __time32_t r = _Time1 - _Time2;
   if (r > _Time1)
     return -((double) (_Time2 - _Time1));
   return (double) r;
diff --git a/mingw-w64-crt/misc/difftime64.c b/mingw-w64-crt/misc/difftime64.c
index d50006b..54f9a12 100644
--- a/mingw-w64-crt/misc/difftime64.c
+++ b/mingw-w64-crt/misc/difftime64.c
@@ -1,8 +1,8 @@
-double _difftime64(unsigned long long _Time1,unsigned long long _Time2);
+#include <time.h>
 
-double _difftime64(unsigned long long _Time1,unsigned long long _Time2)
+double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2)
 {
-  unsigned long long r = _Time1 - _Time2;
+  __time64_t r = _Time1 - _Time2;
   if (r > _Time1)
     return -((double) (_Time2 - _Time1));
   return (double) r;
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to