diff --git a/newlib/libc/include/sys/_timespec.h b/newlib/libc/include/sys/_timespec.h index 4a7aabcb1..7609e4a46 100644 --- a/newlib/libc/include/sys/_timespec.h +++ b/newlib/libc/include/sys/_timespec.h @@ -36,9 +36,10 @@ #include -#ifndef __time_t_defined +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED) typedef _TIME_T_ time_t; #define __time_t_defined +#define _TIME_T_DECLARED #endif struct timespec { diff --git a/newlib/libc/include/sys/_timeval.h b/newlib/libc/include/sys/_timeval.h index d813d1f5b..676a0b894 100644 --- a/newlib/libc/include/sys/_timeval.h +++ b/newlib/libc/include/sys/_timeval.h @@ -36,9 +36,10 @@ typedef __suseconds_t suseconds_t; #define _SUSECONDS_T_DECLARED #endif -#ifndef __time_t_defined +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED) typedef _TIME_T_ time_t; #define __time_t_defined +#define _TIME_T_DECLARED #endif /* This define is also used outside of Newlib, e.g. in MinGW-w64 */ diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index 7102a4fa0..1ba4c6469 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -148,7 +148,9 @@ typedef void *_iconv_t; #define _CLOCK_T_ unsigned long /* clock() */ typedef _CLOCK_T_ __clock_t; -#define _TIME_T_ long /* time() */ +#define _TIME_T_ long /* time() */ +typedef _TIME_T_ __time_t; + #define _CLOCKID_T_ unsigned long #define _TIMER_T_ unsigned long diff --git a/newlib/libc/include/sys/timeb.h b/newlib/libc/include/sys/timeb.h index 264783050..793b48143 100644 --- a/newlib/libc/include/sys/timeb.h +++ b/newlib/libc/include/sys/timeb.h @@ -17,9 +17,10 @@ extern "C" { #include <_ansi.h> #include -#ifndef __time_t_defined -typedef _TIME_T_ time_t; -#define __time_t_defined +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED) +typedef _TIME_T_ time_t; +#define __time_t_defined +#define _TIME_T_DECLARED #endif struct timeb diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index f17821bce..2338cf50b 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -102,9 +102,10 @@ typedef _CLOCK_T_ clock_t; #define _CLOCK_T_DECLARED #endif -#ifndef __time_t_defined -typedef _TIME_T_ time_t; -#define __time_t_defined +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED) +typedef _TIME_T_ time_t; +#define __time_t_defined +#define _TIME_T_DECLARED #endif #ifndef __daddr_t_defined diff --git a/newlib/libc/sys/sparc64/sys/_timeval.h b/newlib/libc/sys/sparc64/sys/_timeval.h index fbe9ce64d..b0aaeda7e 100644 --- a/newlib/libc/sys/sparc64/sys/_timeval.h +++ b/newlib/libc/sys/sparc64/sys/_timeval.h @@ -3,9 +3,10 @@ #include -#ifndef __time_t_defined -typedef _TIME_T_ time_t; -#define __time_t_defined +#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED) +typedef _TIME_T_ time_t; +#define __time_t_defined +#define _TIME_T_DECLARED #endif #ifdef __cplusplus