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

Jonathon Jongsma jjongsma at redhat.com
Wed Dec 9 08:29:54 PST 2015


On Wed, 2015-12-09 at 10:45 -0500, Frediano Ziglio wrote:
> > 
> > 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.

By the way, I already pushed this patch. I mentioned that in a different thread,
but thought I'd mention it here as well.

Jonathon



More information about the Spice-devel mailing list