mirror of
https://github.com/brl/mutter.git
synced 2025-06-19 11:34:14 +00:00
Start using the monotonic API in GLib ≥ 2.27
Starting from the 2.27 cycle, GLib is exposing a monotonic clock with microseconds granularity throughout the time-based API. We can start using it, given that the old, non-monotonic version is going to be deprecated by the same cycle.
This commit is contained in:
@ -34,12 +34,17 @@ void
|
||||
_clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
|
||||
guint fps)
|
||||
{
|
||||
GTimeVal start_time;
|
||||
#if GLIB_CHECK_VERSION (2, 27, 3)
|
||||
interval->start_time = g_get_monotonic_time () / 1000;
|
||||
#else
|
||||
{
|
||||
GTimeVal start_time;
|
||||
g_get_current_time (&start_time);
|
||||
interval->start_time = start_time.tv_sec * 1000
|
||||
+ start_time.tv_usec / 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_get_current_time (&start_time);
|
||||
|
||||
interval->start_time = start_time.tv_sec * 1000
|
||||
+ start_time.tv_usec / 1000;
|
||||
interval->fps = fps;
|
||||
interval->frame_count = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user