wayland: use glib function for fetching timestamp

The code currently implements a function, get_time, that
fetches a timestamp.  That duplicates code already in glib,
and the glib implementation is better, anyway, since it doesn't
skew backward when the system clock is changed.

This commit changes the code to use g_get_monotonic_time and
drop the get_time function.

https://bugzilla.gnome.org/show_bug.cgi?id=761613
This commit is contained in:
Ray Strode 2016-02-05 13:58:51 -05:00
parent 55eef2deb3
commit 50099c4c10

View File

@ -48,14 +48,6 @@ meta_wayland_compositor_get_default (void)
return &_meta_wayland_compositor; return &_meta_wayland_compositor;
} }
static guint32
get_time (void)
{
struct timeval tv;
gettimeofday (&tv, NULL);
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
typedef struct typedef struct
{ {
GSource source; GSource source;
@ -186,7 +178,7 @@ meta_wayland_compositor_paint_finished (MetaWaylandCompositor *compositor)
MetaWaylandFrameCallback *callback = MetaWaylandFrameCallback *callback =
wl_container_of (compositor->frame_callbacks.next, callback, link); wl_container_of (compositor->frame_callbacks.next, callback, link);
wl_callback_send_done (callback->resource, get_time ()); wl_callback_send_done (callback->resource, g_get_monotonic_time () / 1000);
wl_resource_destroy (callback->resource); wl_resource_destroy (callback->resource);
} }
} }