r3221 - trunk/libmutil/source

mikma at minisip.org mikma at minisip.org
Mon Feb 26 16:40:05 CET 2007


Author: mikma
Date: 2007-02-26 16:40:04 +0100 (Mon, 26 Feb 2007)
New Revision: 3221

Modified:
   trunk/libmutil/source/mtimeWin32.cxx
Log:
Fix build error, _ftime64_s not defined on mingw32

Modified: trunk/libmutil/source/mtimeWin32.cxx
===================================================================
--- trunk/libmutil/source/mtimeWin32.cxx	2007-02-23 16:16:37 UTC (rev 3220)
+++ trunk/libmutil/source/mtimeWin32.cxx	2007-02-26 15:40:04 UTC (rev 3221)
@@ -31,15 +31,22 @@
 #include <sys/timeb.h>
 #include <winsock2.h>
 
-LIBMUTIL_API uint64_t mtime(){
-	#ifdef _WIN32_WCE
-		struct timeb tb;
+
+static mutil_ftime( struct timeb *tb ){
+#ifdef _WIN32_WCE
 		_ftime (&tb);
-	#else
-		struct _timeb tb;
+#elif defined(__MINGW32__)
+		_ftime64 (&tb);
+#else
 		_ftime64_s (&tb);
-	#endif
+#endif
 
+}
+
+LIBMUTIL_API uint64_t mtime(){
+		struct timeb tb;
+		mutil_ftime (&tb);
+
 	return ((uint64_t)tb.time) * (int64_t)1000 + ((uint64_t)tb.millitm);
 }
 
@@ -47,13 +54,8 @@
 extern "C" {
 LIBMUTIL_API
 	void gettimeofday (struct timeval *tv, struct timezone *tz){
-		#ifdef _WIN32_WCE
 		struct timeb tb;
-		_ftime (&tb);
-		#else
-		struct _timeb tb;
-		_ftime64_s (&tb);
-		#endif
+		mutil_ftime (&tb);
 
 		tv->tv_sec = (long)tb.time; // Fix: tv_sec wraps year 2038 (tv.time is ok though)
 		tv->tv_usec = tb.millitm * 1000L;



More information about the Minisip-devel mailing list