Commit 962809cb authored by Andreas Rauschert's avatar Andreas Rauschert
Browse files

Make SecondsToTime templated again


Signed-off-by: Andreas Rauschert's avatarAndreas Rauschert <andreas.rb.rauschert@bmw.de>
parent 2e1e1aef
......@@ -22,11 +22,13 @@ namespace mantle_api
using Time = units::time::millisecond_t;
/// @brief Converts input in [s] to @ref Time.
/// @tparam T Input type, e.g. `double`.
/// @param duration Input value
/// @return Duration representing the given input in units of @ref Time.
inline Time SecondsToTime(double duration)
template <typename T>
inline Time SecondsToTime(T duration)
{
return {std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>{duration})};
return {std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<T>{duration})};
}
/// @brief Converts input @ref Time to [s].
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment