Skip to content

Commit 94b3018

Browse files
author
Felipe Neves
authored
time_unix: namespace zephyr headers (ros2#383)
when kernel is above version 3. Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
1 parent e46f124 commit 94b3018

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/time_unix.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ extern "C"
3030
#include <math.h>
3131

3232
#if defined(__ZEPHYR__)
33-
#include <posix/time.h> // Points to Zephyr toolchain posix time implementation
33+
#include <version.h>
34+
#if KERNELVERSION >= ZEPHYR_VERSION(3, 1, 0)
35+
#include <zephyr/posix/time.h> // Points to Zephyr toolchain posix time implementation
3436
#else
37+
#include <posix/time.h> // Points to Zephyr toolchain posix time implementation
38+
#endif
39+
#else // #if KERNELVERSION >= ZEPHYR_VERSION(3, 1, 0)
3540
#include <time.h>
3641
#endif // defined(__ZEPHYR__)
37-
#include <unistd.h>
3842

43+
#include <unistd.h>
3944
#include "./common.h"
4045
#include "rcutils/allocator.h"
4146
#include "rcutils/error_handling.h"

0 commit comments

Comments
 (0)