From d97ec73c3feef2af478f2a22ac00c84050f7c69d Mon Sep 17 00:00:00 2001 From: tanyanquan Date: Wed, 4 Feb 2026 03:38:28 +0800 Subject: [PATCH] [uptime] move `otConvertDurationInSecondsToString` to FTD/MTD block (#12336) The fix moves the necessary includes outside the FTD/MTD conditional block: - Added explicit include: #include "common/uptime.hpp" is now included when OPENTHREAD_CONFIG_UPTIME_ENABLE is defined, regardless of FTD/MTD mode. - Extended namespace usage: The using namespace ot; directive now applies when either FTD/MTD is enabled OR uptime is enabled, ensuring the namespace is available for the uptime functions. This ensures that when OPENTHREAD_CONFIG_UPTIME_ENABLE is enabled, the required headers are included even in RADIO mode, allowing the uptime functionality to work correctly across all device types. --- src/core/api/thread_api.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index ad2c43533..8291189de 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -527,8 +527,6 @@ otError otThreadWakeup(otInstance *aInstance, } #endif -#endif // OPENTHREAD_FTD || OPENTHREAD_MTD - #if OPENTHREAD_CONFIG_UPTIME_ENABLE void otConvertDurationInSecondsToString(uint32_t aDuration, char *aBuffer, uint16_t aSize) { @@ -538,3 +536,5 @@ void otConvertDurationInSecondsToString(uint32_t aDuration, char *aBuffer, uint1 UptimeToString(uptime, writer, /* aIncludeMsec */ false); } #endif + +#endif // OPENTHREAD_FTD || OPENTHREAD_MTD