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.
Unified · Split
| @@ -12,7 +12,7 @@ · 11 unmodified lines | |||
| 12 | #ifndef VPX_TIMER_H | 12 | #ifndef VPX_TIMER_H |
| 13 | #define VPX_TIMER_H | 13 | #define VPX_TIMER_H |
| 14 | 14 | ||
| 15 | #if defined(_MSC_VER) | 15 | #if defined(_WIN32) |
| 16 | /* | 16 | /* |
| 17 | * Win32 specific includes | 17 | * Win32 specific includes |
| 18 | */ | 18 | */ |
| @@ -43,7 +43,7 @@ · 24 unmodified lines | |||
| 43 | 43 | ||
| 44 | struct vpx_usec_timer | 44 | struct vpx_usec_timer |
| 45 | { | 45 | { |
| 46 | #if defined(_MSC_VER) | 46 | #if defined(_WIN32) |
| 47 | LARGE_INTEGER begin, end; | 47 | LARGE_INTEGER begin, end; |
| 48 | #else | 48 | #else |
| 49 | struct timeval begin, end; | 49 | struct timeval begin, end; |
| @@ -54,7 +54,7 @@ struct vpx_usec_timer · 4 unmodified lines | |||
| 54 | static void | 54 | static void |
| 55 | vpx_usec_timer_start(struct vpx_usec_timer *t) | 55 | vpx_usec_timer_start(struct vpx_usec_timer *t) |
| 56 | { | 56 | { |
| 57 | #if defined(_MSC_VER) | 57 | #if defined(_WIN32) |
| 58 | QueryPerformanceCounter(&t->begin); | 58 | QueryPerformanceCounter(&t->begin); |
| 59 | #else | 59 | #else |
| 60 | gettimeofday(&t->begin, NULL); | 60 | gettimeofday(&t->begin, NULL); |
| @@ -65,7 +65,7 @@ vpx_usec_timer_start(struct vpx_usec_timer *t) · 4 unmodified lines | |||
| 65 | static void | 65 | static void |
| 66 | vpx_usec_timer_mark(struct vpx_usec_timer *t) | 66 | vpx_usec_timer_mark(struct vpx_usec_timer *t) |
| 67 | { | 67 | { |
| 68 | #if defined(_MSC_VER) | 68 | #if defined(_WIN32) |
| 69 | QueryPerformanceCounter(&t->end); | 69 | QueryPerformanceCounter(&t->end); |
| 70 | #else | 70 | #else |
| 71 | gettimeofday(&t->end, NULL); | 71 | gettimeofday(&t->end, NULL); |
| @@ -76,7 +76,7 @@ vpx_usec_timer_mark(struct vpx_usec_timer *t) · 4 unmodified lines | |||
| 76 | static long | 76 | static long |
| 77 | vpx_usec_timer_elapsed(struct vpx_usec_timer *t) | 77 | vpx_usec_timer_elapsed(struct vpx_usec_timer *t) |
| 78 | { | 78 | { |
| 79 | #if defined(_MSC_VER) | 79 | #if defined(_WIN32) |
| 80 | LARGE_INTEGER freq, diff; | 80 | LARGE_INTEGER freq, diff; |
| 81 | 81 | ||
| 82 | diff.QuadPart = t->end.QuadPart - t->begin.QuadPart; | 82 | diff.QuadPart = t->end.QuadPart - t->begin.QuadPart; |