From 5e40624ec0c5c10418b991fe17b14241b71dced8 Mon Sep 17 00:00:00 2001 From: Achim Kraus Date: Fri, 7 Jan 2022 11:41:51 +0100 Subject: [PATCH] dtls_time.h: conditionally include time header files. Include time.h and sys/time.h based on HAVE_TIME_H and HAVE_SYS_TIME_H. Signed-off-by: Achim Kraus --- dtls_time.h | 5 +++++ sha2/sha2speed.c | 2 ++ tests/dsrv-test.c | 2 ++ tests/dtls-client.c | 3 +++ tests/dtls-server.c | 2 ++ 5 files changed, 14 insertions(+) diff --git a/dtls_time.h b/dtls_time.h index f16b2d09..f9974327 100644 --- a/dtls_time.h +++ b/dtls_time.h @@ -23,7 +23,10 @@ #define _DTLS_DTLS_TIME_H_ #include + +#ifdef HAVE_SYS_TIME_H #include +#endif /* HAVE_SYS_TIME_H */ #include "tinydtls.h" @@ -50,7 +53,9 @@ typedef uint64_t clock_time_t; #else /* WITH_CONTIKI || RIOT_VERSION */ +#ifdef HAVE_TIME_H #include +#endif /* HAVE_TIME_H */ #ifndef CLOCK_SECOND # define CLOCK_SECOND 1000 diff --git a/sha2/sha2speed.c b/sha2/sha2speed.c index 77d17aff..9cf44a56 100644 --- a/sha2/sha2speed.c +++ b/sha2/sha2speed.c @@ -35,7 +35,9 @@ #include #include #include +#ifdef HAVE_SYS_TIME_H #include +#endif /* HAVE_SYS_TIME_H */ #include "sha2.h" diff --git a/tests/dsrv-test.c b/tests/dsrv-test.c index e7b44a9e..4ef46051 100644 --- a/tests/dsrv-test.c +++ b/tests/dsrv-test.c @@ -4,7 +4,9 @@ #include #include #include +#ifdef HAVE_SYS_TIME_H #include +#endif /* HAVE_SYS_TIME_H */ #include "dsrv.h" diff --git a/tests/dtls-client.c b/tests/dtls-client.c index 2a963e0d..6058f99f 100644 --- a/tests/dtls-client.c +++ b/tests/dtls-client.c @@ -11,7 +11,10 @@ #include #include #include +#ifdef HAVE_SYS_TIME_H #include +#endif /* HAVE_SYS_TIME_H */ + #include #include #include diff --git a/tests/dtls-server.c b/tests/dtls-server.c index 05b7d311..e76876b7 100644 --- a/tests/dtls-server.c +++ b/tests/dtls-server.c @@ -10,7 +10,9 @@ #include #include #include +#ifdef HAVE_SYS_TIME_H #include +#endif /* HAVE_SYS_TIME_H */ #include #include