Skip to content
Snippets Groups Projects
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 eclipse/simopenpass/scenario_api!25
parents b9b8a064 962809cb
No related branches found
No related tags found
1 merge request!25Fix time conversion to ms
......@@ -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 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].
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment