From 50099c4c10c9311c6d0deb978d21637c9437c027 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 5 Feb 2016 13:58:51 -0500 Subject: [PATCH] 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 --- src/wayland/meta-wayland.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index d51e8b558..523fbceb7 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -48,14 +48,6 @@ meta_wayland_compositor_get_default (void) 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 { GSource source; @@ -186,7 +178,7 @@ meta_wayland_compositor_paint_finished (MetaWaylandCompositor *compositor) MetaWaylandFrameCallback *callback = 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); } }