Skip to content

Commit a6aee9b

Browse files
pfalconnashif
authored andcommitted
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 <[email protected]>
1 parent 81fa697 commit a6aee9b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/posix/sys/time.h

+16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,23 @@
77
#ifndef ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_
88
#define ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_
99

10+
#ifdef CONFIG_NEWLIB_LIBC
11+
/* Kludge to support outdated newlib version as used in SDK 0.10 for Xtensa */
12+
#include <newlib.h>
13+
14+
#ifdef __NEWLIB__
15+
#include <sys/_timeval.h>
16+
#else
17+
#include <sys/types.h>
18+
struct timeval {
19+
time_t tv_sec;
20+
suseconds_t tv_usec;
21+
};
22+
#endif
23+
24+
#else
1025
#include <sys/_timeval.h>
26+
#endif /* CONFIG_NEWLIB_LIBC */
1127

1228
#ifdef __cplusplus
1329
extern "C" {

0 commit comments

Comments
 (0)