Skip to content

Commit f1d8378

Browse files
committed
Improve condition for declaring struct timeval
1 parent bfdd916 commit f1d8378

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

platform/include/platform/mbed_rtc_time.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ extern "C" {
3232
* @{
3333
*/
3434

35-
/* Timeval definition for non GCC_ARM toolchains */
36-
#if !defined(__GNUC__) || defined(__clang__)
35+
/* Timeval definition for non GCC_ARM toolchains,
36+
* Note: The GNU libc defines _TIMEVAL_DEFINED and the newlib defines __timeval_defined,
37+
* thus the double-check and double-define
38+
*/
39+
#if !defined(__timeval_defined) && !defined(_TIMEVAL_DEFINED)
40+
#define __timeval_defined 1
41+
#define _TIMEVAL_DEFINED
3742
struct timeval {
3843
time_t tv_sec;
3944
int32_t tv_usec;

0 commit comments

Comments
 (0)