[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.
This commit is contained in:
tanyanquan
2026-02-04 03:38:28 +08:00
committed by GitHub
parent a7362c1a45
commit d97ec73c3f
+2 -2
View File
@@ -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