diff --git a/features/FEATURE_BLE/ble/common/Duration.h b/features/FEATURE_BLE/ble/common/Duration.h index ce4588ec1d..f37a03025e 100644 --- a/features/FEATURE_BLE/ble/common/Duration.h +++ b/features/FEATURE_BLE/ble/common/Duration.h @@ -18,6 +18,7 @@ #define BLE_COMMON_DURATION_H_ #include +#include #include "platform/mbed_assert.h" namespace ble { @@ -62,6 +63,11 @@ struct Duration { MBED_STATIC_ASSERT(OtherTB >= TB && (OtherTB % TB) == 0, "Incompatible units"); } + template + explicit Duration(Duration other_ms, void* = NULL) : + duration(clamp(((other_ms.value() * 1000) + TB - 1) / TB)) + { } + Rep value() { return duration; }