From f1d83782185955aee272da74aa6fc60f8a75c0c4 Mon Sep 17 00:00:00 2001 From: Maciej Bogusz Date: Tue, 13 Apr 2021 15:47:01 +0200 Subject: [PATCH] Improve condition for declaring struct timeval --- platform/include/platform/mbed_rtc_time.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/include/platform/mbed_rtc_time.h b/platform/include/platform/mbed_rtc_time.h index f85796ba5b7..1fb538f1736 100644 --- a/platform/include/platform/mbed_rtc_time.h +++ b/platform/include/platform/mbed_rtc_time.h @@ -32,8 +32,13 @@ extern "C" { * @{ */ -/* Timeval definition for non GCC_ARM toolchains */ -#if !defined(__GNUC__) || defined(__clang__) +/* Timeval definition for non GCC_ARM toolchains, + * Note: The GNU libc defines _TIMEVAL_DEFINED and the newlib defines __timeval_defined, + * thus the double-check and double-define + */ +#if !defined(__timeval_defined) && !defined(_TIMEVAL_DEFINED) +#define __timeval_defined 1 +#define _TIMEVAL_DEFINED struct timeval { time_t tv_sec; int32_t tv_usec;