From 7495c3066d7b67bbc74b1d5565684ff48e430099 Mon Sep 17 00:00:00 2001 From: Ramiro Polla Date: Fri, 13 Jul 2007 16:11:36 +0000 Subject: Check for GetProcessTimes and use it in getutime Originally committed as revision 9629 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ffmpeg.c') diff --git a/ffmpeg.c b/ffmpeg.c index 3539ae0bbf..ac52d7a2bb 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -34,6 +34,10 @@ #include "fifo.h" #include "avstring.h" +#if !defined(HAVE_GETRUSAGE) && defined(HAVE_GETPROCESSTIMES) +#include +#endif + #if defined(HAVE_TERMIOS_H) #include #include @@ -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 } -- cgit v1.2.3