[Spice-devel] RFC: Time functions in Spice
Jonathon Jongsma
jjongsma at redhat.com
Mon Dec 7 07:58:10 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()
perhaps? Maybe that's no better though.
Jonathon
More information about the Spice-devel
mailing list