From 81fa697f3296dbed6192c993d506b21872f0f210 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 24 Apr 2019 00:43:25 +0300 Subject: [PATCH] posix: Move gettimeofday declaration to According to POSIX, that's the header which defines this function. Similarly, nothing in POSIX indicates that should have access to struct timeval, so it's removed (it's made accessible to via introduced earlier). Signed-off-by: Paul Sokolovsky --- include/posix/sys/time.h | 22 ++++++++++++++++++++++ include/posix/time.h | 7 ------- lib/posix/clock.c | 1 + tests/posix/common/src/clock.c | 1 + 4 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 include/posix/sys/time.h 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