Re: [PATCH] libgst: Fix small amount of sleeps on OSX

Paolo Bonzini <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>

On 17/04/2015 23:38, Holger Hans Peter Freyther wrote:
> +      if (deltaNano <= 1000000)
> +        {
> +          value.it_value.tv_sec = 0;
> +          value.it_value.tv_usec = 1;
> +        }
> +      else
> +        {
> +          int64_t deltaMilli = deltaNano / 1000000;
> +          value.it_value.tv_sec = deltaMilli / 1000;
> +          value.it_value.tv_usec = (deltaMilli % 1000) * 1000;
> +        }
>        setitimer (ITIMER_REAL, &value, (struct itimerval *) 0);

Why not:

          int64_t deltaMicro = deltaNano < 1000 ? 1 : deltaNano / 1000;
          value.it_value.tv_sec = deltaMicro / 1000000;
          value.it_value.tv_usec = deltaMicro % 1000000;

?

Paolo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.