[Spice-devel] server: Use g_get_monotonic_time() to get the time in microseconds

Frediano Ziglio fziglio at redhat.com
Wed Dec 9 07:45:28 PST 2015


> 
> On Wed, 9 Dec 2015, Frediano Ziglio wrote:
> [...]
> > > > -    clock_gettime(CLOCK_MONOTONIC, &time_space);
> > > > -    ping.timestamp = time_space.tv_sec * 1000000LL +
> > > > time_space.tv_nsec /
> > > > 1000LL;
> 
> Here we convert the nanoseconds to microseconds.
> 
> [...]
> > > > -        clock_gettime(CLOCK_MONOTONIC, &ts);
> > > > -        roundtrip = ts.tv_sec * 1000000LL + ts.tv_nsec / 1000LL -
> > > > ping->timestamp;
> 
> Same here.
> 
> 
> > Are we sure about this patch?
> > The ping message is sent and received to/from client so it seems that
> > microseconds to nanoseconds change is an ABI change.
> 
> There is no such change.
>  * As documented above we used to compute a time in microseconds.
>  * Now we call g_get_monotonic_time() which returns a time in
>    _microseconds_, unlike the similarly named spice_monotonic_time().
>    https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html#g-get-monotonic-time
> 
> So I'll add this as further evidence that the 'spice_monotonic_time()'
> name is confusing for my 'Time functions in Spice' thread.
> 
> http://lists.freedesktop.org/archives/spice-devel/2015-December/024692.html
> 
> --
> Francois Gouget <fgouget at codeweavers.com>
> 

Yes, sorry, I was confused by our function returning nanoseconds.

Frediano


More information about the Spice-devel mailing list