Use native win32 timers on mingw

Changed to use QueryPerformanceCounter on Windows rather than only
when building with MSVC, so that MSVC can link libs built with
MinGW.

Fixes issue #149.

Change-Id: Ie2dc7edc8f4d096cf95ec5ffb1ab00f2d67b3e7d
This commit is contained in:
John Koleszar 2010-09-02 12:03:51 -04:00
parent d6ee72a7bf
commit daab4bcba6

View File

@ -12,7 +12,7 @@
#ifndef VPX_TIMER_H
#define VPX_TIMER_H
#if defined(_MSC_VER)
#if defined(_WIN32)
/*
* Win32 specific includes
*/
@ -43,7 +43,7 @@
struct vpx_usec_timer
{
#if defined(_MSC_VER)
#if defined(_WIN32)
LARGE_INTEGER begin, end;
#else
struct timeval begin, end;
@ -54,7 +54,7 @@ struct vpx_usec_timer
static void
vpx_usec_timer_start(struct vpx_usec_timer *t)
{
#if defined(_MSC_VER)
#if defined(_WIN32)
QueryPerformanceCounter(&t->begin);
#else
gettimeofday(&t->begin, NULL);
@ -65,7 +65,7 @@ vpx_usec_timer_start(struct vpx_usec_timer *t)
static void
vpx_usec_timer_mark(struct vpx_usec_timer *t)
{
#if defined(_MSC_VER)
#if defined(_WIN32)
QueryPerformanceCounter(&t->end);
#else
gettimeofday(&t->end, NULL);
@ -76,7 +76,7 @@ vpx_usec_timer_mark(struct vpx_usec_timer *t)
static long
vpx_usec_timer_elapsed(struct vpx_usec_timer *t)
{
#if defined(_MSC_VER)
#if defined(_WIN32)
LARGE_INTEGER freq, diff;
diff.QuadPart = t->end.QuadPart - t->begin.QuadPart;