[mutter] wayland: use glib function for fetching timestamp



commit 50099c4c10c9311c6d0deb978d21637c9437c027
Author: Ray Strode <rstrode redhat com>
Date:   Fri Feb 5 13:58:51 2016 -0500

    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 files changed, 1 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index d51e8b5..523fbce 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);
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]