diff --git a/include/posix/time.h b/include/posix/time.h index 2838399cd64..169bd73d7d8 100644 --- a/include/posix/time.h +++ b/include/posix/time.h @@ -10,14 +10,7 @@ extern "C" { #endif - -#ifndef __timespec_defined -#define __timespec_defined -struct timespec { - signed int tv_sec; - signed int tv_nsec; -}; -#endif +#include /* Older newlib's like 2.{0-2}.0 don't define any newlib version defines, only * __NEWLIB_H__ so we use that to decide if itimerspec was defined in diff --git a/lib/libc/minimal/include/sys/_timespec.h b/lib/libc/minimal/include/sys/_timespec.h new file mode 100644 index 00000000000..5e8364c7726 --- /dev/null +++ b/lib/libc/minimal/include/sys/_timespec.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMESPEC_H_ +#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMESPEC_H_ + +#include + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMESPEC_H_ */