[vlc-devel] [PATCH] core: fix vlc_tick_now on darwin platform

Steve Lhomme robux4 at ycbcr.xyz
Wed Sep 26 20:19:20 CEST 2018


Indeed CLOCK_FREQ wasn't directly involved. Which is wrong.
But reverting is probably better for now.

On 26/09/2018 19:23, Zhao Zhili wrote:
> regression by fdc5af257000eda4b44533005c27a7064275428e
> 1. The math was incorrect. date * vlc_clock_conversion_factor.numer / denom
> is in the unit of microsecond, not second
> 2. It has overflow problem
> ---
>   src/darwin/thread.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/darwin/thread.c b/src/darwin/thread.c
> index f5eb4f234e..884483fb8a 100644
> --- a/src/darwin/thread.c
> +++ b/src/darwin/thread.c
> @@ -523,7 +523,9 @@ vlc_tick_t vlc_tick_now (void)
>       denom *= UINT64_C(1000);
>   
>       /* Split the division to prevent overflow */
> -    return vlc_tick_from_frac( date * vlc_clock_conversion_factor.numer, denom );
> +    lldiv_t d = lldiv (vlc_clock_conversion_factor.numer, denom);
> +
> +    return (d.quot * date) + ((d.rem * date) / denom);
>   }
>   
>   #undef vlc_tick_wait
> -- 
> 2.15.2 (Apple Git-101.1)
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list