u/time: Add ms to ns helper

This commit is contained in:
Jakob Bornecrantz 2023-05-08 12:02:08 +01:00
parent f1bc10003d
commit bfb3d7029c

View file

@ -108,6 +108,19 @@ time_ns_to_ms_f(time_duration_ns ns)
return (double)(ns) / (double)(U_TIME_1MS_IN_NS);
}
/*!
* Convert double float milliseconds to nanoseconds, human comprehensible config
* inputs. Recommended to keep the absolute value of the input relitively small.
*
* @see timepoint_ns
* @ingroup aux_util
*/
static inline timepoint_ns
time_ms_f_to_ns(double ms_f)
{
return (timepoint_ns)(ms_f * (double)(U_TIME_1MS_IN_NS));
}
/*!
* Checks if two timepoints are with a certain range of each other.
*