zephyr/include/posix/sys/time.h
Paul Sokolovsky a6aee9b4c8 posix: sys/time.h: Add workaround for outdated newlib used by Xtensa
Unfortunately, Zephyr SDK 0.10.0 ships with outdate Newlib 2.0.0
(from 2015 or earlier) which lacks sys/_timeval.h header, requiring
ugly workaround of defining struct timeval inline (the whole idea
was to standardize on sys/_timeval.h header for different libc's).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-07 22:18:09 -04:00

39 lines
670 B
C

/*
* 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_
#ifdef CONFIG_NEWLIB_LIBC
/* Kludge to support outdated newlib version as used in SDK 0.10 for Xtensa */
#include <newlib.h>
#ifdef __NEWLIB__
#include <sys/_timeval.h>
#else
#include <sys/types.h>
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
#endif
#else
#include <sys/_timeval.h>
#endif /* CONFIG_NEWLIB_LIBC */
#ifdef __cplusplus
extern "C" {
#endif
int gettimeofday(struct timeval *tv, const void *tz);
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_ */