diff --git a/include/posix/sys/time.h b/include/posix/sys/time.h new file mode 100644 index 00000000000..cd5e68b0515 --- /dev/null +++ b/include/posix/sys/time.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_ +#define ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int gettimeofday(struct timeval *tv, const void *tz); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_ */ diff --git a/include/posix/time.h b/include/posix/time.h index a9bcf82a8d3..2838399cd64 100644 --- a/include/posix/time.h +++ b/include/posix/time.h @@ -34,11 +34,6 @@ struct itimerspec { }; #endif -struct timeval { - signed int tv_sec; - signed int tv_usec; -}; - #include #include #include "posix_types.h" @@ -72,8 +67,6 @@ int timer_gettime(timer_t timerid, struct itimerspec *its); int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); -int gettimeofday(struct timeval *tv, const void *tz); - #ifdef __cplusplus } #endif diff --git a/lib/posix/clock.c b/lib/posix/clock.c index 0805ddda801..e892c1147b9 100644 --- a/lib/posix/clock.c +++ b/lib/posix/clock.c @@ -6,6 +6,7 @@ #include #include #include +#include /* * `k_uptime_get` returns a timestamp based on an always increasing diff --git a/tests/posix/common/src/clock.c b/tests/posix/common/src/clock.c index c93546dcfe5..0e410ee47f7 100644 --- a/tests/posix/common/src/clock.c +++ b/tests/posix/common/src/clock.c @@ -5,6 +5,7 @@ */ #include #include +#include #include #define SLEEP_SECONDS 1