Commit 840c01ab authored by Andreas Rauschert's avatar Andreas Rauschert
Browse files

Merge branch 'bugfix/adjust_time_conversion_to_ms' into 'master'

Fix time conversion to ms

See merge request !25
parents b9b8a064 962809cb
...@@ -22,11 +22,13 @@ namespace mantle_api ...@@ -22,11 +22,13 @@ namespace mantle_api
using Time = units::time::millisecond_t; using Time = units::time::millisecond_t;
/// @brief Converts input in [s] to @ref Time. /// @brief Converts input in [s] to @ref Time.
/// @tparam T Input type, e.g. `double`.
/// @param duration Input value /// @param duration Input value
/// @return Duration representing the given input in units of @ref Time. /// @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 units::time::second_t(duration); return {std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<T>{duration})};
} }
/// @brief Converts input @ref Time to [s]. /// @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