diff --git a/src/display.c b/src/display.c index 40ee24f9e..d9cca8ec5 100644 --- a/src/display.c +++ b/src/display.c @@ -901,7 +901,7 @@ gboolean myDisplayTestXrender (DisplayInfo *display, gdouble min_time) { #ifdef HAVE_RENDER - GTimeVal t1, t2; + gint64 t1, t2; gdouble dt; Display *dpy; Picture picture1, picture2, picture3; @@ -971,7 +971,7 @@ myDisplayTestXrender (DisplayInfo *display, gdouble min_time) DefaultRootWindow(dpy), 1, 1, 8); - g_get_current_time (&t1); + t1 = g_get_monotonic_time (); pa.repeat = TRUE; picture1 = XRenderCreatePicture (dpy, @@ -1011,10 +1011,8 @@ myDisplayTestXrender (DisplayInfo *display, gdouble min_time) XDestroyWindow (dpy, output); - g_get_current_time (&t2); - - dt = (gdouble) (t2.tv_sec - t1.tv_sec) * G_USEC_PER_SEC + - (gdouble) (t2.tv_usec - t1.tv_usec) / 1000.0; + t2 = g_get_monotonic_time (); + dt = (gdouble) (t2 - t1) / 1000.0; if (dt < min_time) { diff --git a/src/startup_notification.c b/src/startup_notification.c index 4fc9e6af5..ece84ee2b 100644 --- a/src/startup_notification.c +++ b/src/startup_notification.c @@ -52,7 +52,7 @@ static SnDisplay *sn_display = NULL; typedef struct { GSList *list; - GTimeVal now; + gint64 now; } CollectTimedOutData; @@ -139,9 +139,8 @@ sn_collect_timed_out_foreach (void *element, void *data) sn_startup_sequence_get_last_active_time (sequence, &l_sec, &l_usec); tv_sec = l_sec; tv_usec = l_sec; - elapsed = - ((((double) ctod->now.tv_sec - tv_sec) * G_USEC_PER_SEC + - (ctod->now.tv_usec - tv_usec))) / 1000.0; + elapsed = ((double) ctod->now - (tv_sec * G_USEC_PER_SEC) - tv_usec) + / 1000.0; if (elapsed > STARTUP_TIMEOUT) { @@ -160,7 +159,7 @@ sn_startup_sequence_timeout (void *data) g_return_val_if_fail (screen_info != NULL, FALSE); ctod.list = NULL; - g_get_current_time (&ctod.now); + ctod.now = g_get_real_time (); g_slist_foreach (screen_info->startup_sequences, sn_collect_timed_out_foreach, &ctod); tmp = ctod.list;