diff --git a/include/zephyr/bluetooth/services/cts.h b/include/zephyr/bluetooth/services/cts.h index 46fb7808cc4ee..5b1c780f68615 100644 --- a/include/zephyr/bluetooth/services/cts.h +++ b/include/zephyr/bluetooth/services/cts.h @@ -16,7 +16,6 @@ */ #include -#include #ifdef __cplusplus extern "C" { diff --git a/subsys/bluetooth/services/cts.c b/subsys/bluetooth/services/cts.c index ce72f7728e019..d5744bc5a2480 100644 --- a/subsys/bluetooth/services/cts.c +++ b/subsys/bluetooth/services/cts.c @@ -7,9 +7,17 @@ * * SPDX-License-Identifier: Apache-2.0 */ + +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L /* To get gmtime_r()'s prototype */ + +#ifdef CONFIG_BT_CTS_HELPER_API +#include +#include +#endif + #include #include -#include #include #include @@ -26,9 +34,6 @@ static const struct bt_cts_cb *cts_cb; #ifdef CONFIG_BT_CTS_HELPER_API -#include -#include - int bt_cts_time_to_unix_ms(const struct bt_cts_time_format *ct_time, int64_t *unix_ms) { struct tm date_time;