Skip to content

Commit

Permalink
Include sys/time.h for cycleclock.h when building on MinGW (#680)
Browse files Browse the repository at this point in the history
When building for ARM, there is a fallback codepath that uses
gettimeofday, which requires sys/time.h.

The Windows SDK doesn't have this header, but MinGW does have it.
Thus, this fixes building for Windows on ARM with MinGW
headers/libraries, while Windows on ARM with the Windows SDK still
is broken.
  • Loading branch information
mstorsjo authored and dominichamon committed Sep 19, 2018
1 parent 5261307 commit 439d6b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cycleclock.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern "C" uint64_t __rdtsc();
#pragma intrinsic(__rdtsc)
#endif

#ifndef BENCHMARK_OS_WINDOWS
#if !defined(BENCHMARK_OS_WINDOWS) || defined(BENCHMARK_OS_MINGW)
#include <sys/time.h>
#include <time.h>
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/internal_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
#define BENCHMARK_OS_CYGWIN 1
#elif defined(_WIN32)
#define BENCHMARK_OS_WINDOWS 1
#if defined(__MINGW32__)
#define BENCHMARK_OS_MINGW 1
#endif
#elif defined(__APPLE__)
#define BENCHMARK_OS_APPLE 1
#include "TargetConditionals.h"
Expand Down

0 comments on commit 439d6b1

Please sign in to comment.