[FFmpeg-cvslog] r9629 - in trunk: configure ffmpeg.c

ramiro subversion
Fri Jul 13 18:11:36 CEST 2007


Author: ramiro
Date: Fri Jul 13 18:11:36 2007
New Revision: 9629

Log:
Check for GetProcessTimes and use it in getutime

Modified:
   trunk/configure
   trunk/ffmpeg.c

Modified: trunk/configure
==============================================================================
--- trunk/configure	(original)
+++ trunk/configure	Fri Jul 13 18:11:36 2007
@@ -667,6 +667,7 @@ HAVE_LIST="
     fast_unaligned
     fork
     freetype2
+    GetProcessTimes
     getrusage
     imlib2
     inet_aton
@@ -1598,6 +1599,7 @@ elif check_func dlopen -ldl; then
 fi
 
 check_func getrusage
+check_func2 windows.h GetProcessTimes
 
 check_func fork
 

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	(original)
+++ trunk/ffmpeg.c	Fri Jul 13 18:11:36 2007
@@ -34,6 +34,10 @@
 #include "fifo.h"
 #include "avstring.h"
 
+#if !defined(HAVE_GETRUSAGE) && defined(HAVE_GETPROCESSTIMES)
+#include <windows.h>
+#endif
+
 #if defined(HAVE_TERMIOS_H)
 #include <unistd.h>
 #include <fcntl.h>
@@ -3112,7 +3116,13 @@ static int64_t getutime(void)
 
     getrusage(RUSAGE_SELF, &rusage);
     return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
-#elif defined(__MINGW32__)
+#elif defined(HAVE_GETPROCESSTIMES)
+    HANDLE proc;
+    FILETIME c, e, k, u;
+    proc = GetCurrentProcess();
+    GetProcessTimes(proc, &c, &e, &k, &u);
+    return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
+#else
   return av_gettime();
 #endif
 }




More information about the ffmpeg-cvslog mailing list