[vlc-devel] [PATCH] posix/wait: Fix timespec calculation
Steve Lhomme
robux4 at ycbcr.xyz
Mon Mar 9 08:06:40 CET 2020
I think parenthesis like this would be clearer:
- (now_from.tv_nsec - now_to.tv_nsec)
It may also be less prone to overflow.
On 2020-03-07 11:45, Marvin Scholz wrote:
> ---
> src/posix/wait.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/posix/wait.c b/src/posix/wait.c
> index a6d58d721b..dfb0c508db 100644
> --- a/src/posix/wait.c
> +++ b/src/posix/wait.c
> @@ -119,7 +119,7 @@ static void vlc_timespec_adjust(clockid_t cid, struct timespec *restrict ts)
> clock_gettime(vlc_clock_id, &now_to);
>
> d = lldiv((ts->tv_sec - now_from.tv_sec + now_to.tv_sec) * 1000000000LL
> - + ts->tv_nsec - now_from.tv_nsec - now_to.tv_nsec, 1000000000LL);
> + + ts->tv_nsec - now_from.tv_nsec + now_to.tv_nsec, 1000000000LL);
>
> ts->tv_sec = d.quot;
> ts->tv_nsec = d.rem;
> --
> 2.21.1 (Apple Git-122.3)
>
> _______________________________________________
> 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