[vlc-devel] [PATCH 05/15] vlc_common: add helper function to convert microseconds to/from mtime_t
Rémi Denis-Courmont
remi at remlab.net
Sat Jun 16 10:56:50 CEST 2018
Le perjantaina 15. kesäkuuta 2018, 18.09.16 EEST Steve Lhomme a écrit :
> ---
> include/vlc_common.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/vlc_common.h b/include/vlc_common.h
> index 3191d3ce4c8..8b4baffcf27 100644
> --- a/include/vlc_common.h
> +++ b/include/vlc_common.h
> @@ -316,6 +316,14 @@ static inline int64_t milli_from_vtick(mtime_t mt)
> return mt / (CLOCK_FREQ / 1000);
> }
>
> +static inline int64_t micro_from_vtick(mtime_t mt)
> +{
> + return mt * INT64_C(1000000) / CLOCK_FREQ;
> +}
> +static inline mtime_t vtick_from_micro(int64_t micro)
> +{
> + return micro * CLOCK_FREQ / INT64_C(1000000);
> +}
> static inline mtime_t vtick_from_nano(int64_t nano)
> {
> return nano / (INT64_C(1000000000) / CLOCK_FREQ);
Use macros to preserve constants.
--
Реми Дёни-Курмон
http://www.remlab.net/
More information about the vlc-devel
mailing list