[Spice-devel] RFC: Time functions in Spice

Frediano Ziglio fziglio at redhat.com
Wed Dec 9 05:54:08 PST 2015


> 
> On Sun, 2015-12-06 at 21:00 +0100, Francois Gouget wrote:
> > So the Spice server has a red_get_monotonic_time() function which, as is
> > the tradition, has a very similar name to a regular Glib function,
> > g_get_monotonic_time(), except that one returns the time in nanoseconds
> > and the other in microseconds and nothing in the name warns the
> > developer of that difference. Also nothing in that function justifies
> > the red_ prefix and it is used quite widely.
> > 
> > There is also reds_get_mm_time() which returns the time in milliseconds.
> > But unlike implied by its name it is also used by sound.c, dcc-send.c
> > and display-channel.c so I'm not sure the reds_ prefix is really
> > justified.
> > 
> > So I propose to rename these functions to spice_nanosecond_time() and
> > spice_millisecond_time() and to define both in utils.h. Would that be
> > ok?
> > 
> > 
> 
> I think the idea sounds reasonable. I wonder if it would be better to keep
> the
> word 'monotonic' in the name though. Something like
> 
> spice_get_monotonic_time_ns()
> spice_get_monotonic_time_ms()
> 

+1 for these names.

> perhaps? Maybe that's no better though.
> 
> Jonathon

Frediano


More information about the Spice-devel mailing list