MinGW has gettimeofday() since mingw-runtime-3.10

Originally committed as revision 9705 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ramiro Polla 2007-07-16 20:27:16 +00:00
parent fc69cc615e
commit c993a83131

View File

@ -21,14 +21,11 @@
*/ */
#include "config.h" #include "config.h"
#include "avformat.h" #include "avformat.h"
#if defined(__MINGW32__) #if !defined(__MINGW32__)
#include <sys/types.h>
#include <sys/timeb.h>
#else
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/time.h>
#endif #endif
#include <sys/time.h>
#include <time.h> #include <time.h>
#ifndef HAVE_SYS_POLL_H #ifndef HAVE_SYS_POLL_H
@ -44,15 +41,9 @@
*/ */
int64_t av_gettime(void) int64_t av_gettime(void)
{ {
#if defined(__MINGW32__)
struct timeb tb;
_ftime(&tb);
return ((int64_t)tb.time * INT64_C(1000) + (int64_t)tb.millitm) * INT64_C(1000);
#else
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
#endif
} }
#ifdef CONFIG_NETWORK #ifdef CONFIG_NETWORK