[Spice-devel] [PATCH spice-server 4/7] DisplayChannel: Use NSEC_PER_MILLISEC

Frediano Ziglio fziglio at redhat.com
Thu Nov 30 18:15:09 UTC 2017


> 
> Instead of using 1000*1000
> 
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
>  server/display-channel.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/server/display-channel.c b/server/display-channel.c
> index 96feabc3c..1c14344be 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -215,10 +215,10 @@ int display_channel_get_streams_timeout(DisplayChannel
> *display)
>          stream = SPICE_CONTAINEROF(item, VideoStream, link);
>          red_time_t delta = (stream->last_time + RED_STREAM_TIMEOUT) - now;
>  
> -        if (delta < 1000 * 1000) {
> +        if (delta < NSEC_PER_MILLISEC) {
>              return 0;
>          }
> -        timeout = MIN(timeout, (unsigned int)(delta / (1000 * 1000)));
> +        timeout = MIN(timeout, (unsigned int)(delta / (NSEC_PER_MILLISEC)));
>      }
>      return timeout;
>  }

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Not only because NSEC_PER_MILLISEC == 1000*1000 but also because the
unit of delta is nanoseconds :-)

Frediano


More information about the Spice-devel mailing list