diff --git a/clutter/tests/conform/timeline-interpolate.c b/clutter/tests/conform/timeline-interpolate.c index 5eab888b3..3988c038d 100644 --- a/clutter/tests/conform/timeline-interpolate.c +++ b/clutter/tests/conform/timeline-interpolate.c @@ -18,7 +18,7 @@ typedef struct _TestState { ClutterTimeline *timeline; - GTimeVal start_time; + int64_t start_time; guint new_frame_counter; gint expected_frame; gint completion_count; @@ -31,18 +31,17 @@ new_frame_cb (ClutterTimeline *timeline, gint frame_num, TestState *state) { - GTimeVal current_time; + int64_t current_time; gint current_frame; glong msec_diff; gint loop_overflow = 0; static gint step = 1; - g_get_current_time (¤t_time); + current_time = g_get_real_time (); current_frame = clutter_timeline_get_elapsed_time (state->timeline); - msec_diff = (current_time.tv_sec - state->start_time.tv_sec) * 1000; - msec_diff += (current_time.tv_usec - state->start_time.tv_usec)/1000; + msec_diff = (current_time - state->start_time) / G_TIME_SPAN_MILLISECOND; /* If we expect to have interpolated past the end of the timeline * we keep track of the overflow so we can determine when @@ -153,7 +152,7 @@ timeline_interpolation (void) state.passed = TRUE; state.expected_frame = 0; - g_get_current_time (&state.start_time); + state.start_time = g_get_real_time (); clutter_timeline_start (state.timeline); clutter_main(); diff --git a/src/core/display-private.h b/src/core/display-private.h index 7ff572a1c..d4ee5a192 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -191,7 +191,7 @@ struct _MetaDisplay MetaRectangle grab_initial_window_pos; int grab_initial_x, grab_initial_y; /* These are only relevant for */ gboolean grab_threshold_movement_reached; /* raise_on_click == FALSE. */ - GTimeVal grab_last_moveresize_time; + int64_t grab_last_moveresize_time; MetaEdgeResistanceData *grab_edge_resistance_data; unsigned int grab_last_user_action_was_snap; diff --git a/src/core/display.c b/src/core/display.c index 4f56673b9..ea2dd762a 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1783,8 +1783,7 @@ meta_display_begin_grab_op (MetaDisplay *display, display->grab_anchor_root_y = root_y; display->grab_latest_motion_x = root_x; display->grab_latest_motion_y = root_y; - display->grab_last_moveresize_time.tv_sec = 0; - display->grab_last_moveresize_time.tv_usec = 0; + display->grab_last_moveresize_time = 0; display->grab_last_user_action_was_snap = FALSE; display->grab_frame_action = frame_action; diff --git a/src/core/window.c b/src/core/window.c index 322cdaa42..88e9d26e2 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -5908,32 +5908,16 @@ meta_window_titlebar_is_onscreen (MetaWindow *window) return is_onscreen; } -static double -timeval_to_ms (const GTimeVal *timeval) -{ - return (timeval->tv_sec * G_USEC_PER_SEC + timeval->tv_usec) / 1000.0; -} - -static double -time_diff (const GTimeVal *first, - const GTimeVal *second) -{ - double first_ms = timeval_to_ms (first); - double second_ms = timeval_to_ms (second); - - return first_ms - second_ms; -} - static gboolean check_moveresize_frequency (MetaWindow *window, gdouble *remaining) { - GTimeVal current_time; + int64_t current_time; const double max_resizes_per_second = 25.0; const double ms_between_resizes = 1000.0 / max_resizes_per_second; double elapsed; - g_get_current_time (¤t_time); + current_time = g_get_real_time (); /* If we are throttling via _NET_WM_SYNC_REQUEST, we don't need * an artificial timeout-based throttled */ @@ -5941,7 +5925,7 @@ check_moveresize_frequency (MetaWindow *window, window->sync_request_alarm != None) return TRUE; - elapsed = time_diff (¤t_time, &window->display->grab_last_moveresize_time); + elapsed = (current_time - window->display->grab_last_moveresize_time) / 1000; if (elapsed >= 0.0 && elapsed < ms_between_resizes) { @@ -6358,7 +6342,7 @@ update_resize (MetaWindow *window, /* Store the latest resize time, if we actually resized. */ if (window->rect.width != old.width || window->rect.height != old.height) - g_get_current_time (&window->display->grab_last_moveresize_time); + window->display->grab_last_moveresize_time = g_get_real_time (); } static void