Skip to content

Commit

Permalink
tests: Fix build under MinGW
Browse files Browse the repository at this point in the history
MinGW 32-bit does not have timespec_get(). Strangely, the 64-bit version
does have it. But both have clock_gettime(), so only use timespec_get()
when building under Visual Studio.

Fixes #830.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei authored and rgetz committed Apr 6, 2022
1 parent 391f44a commit 47381e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/iio_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ uint64_t get_time_us(void)
{
struct timespec tp;

#ifdef _WIN32
#ifdef _MSC_BUILD
timespec_get(&tp, TIME_UTC);
#else
clock_gettime(CLOCK_REALTIME, &tp);
Expand Down

0 comments on commit 47381e2

Please sign in to comment.