mirror of
https://github.com/brl/mutter.git
synced 2025-07-03 09:43:18 +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:
@ -136,11 +136,18 @@ clutter_timeout_prepare (ClutterTimeoutPool *pool,
|
||||
ClutterTimeout *timeout,
|
||||
gint *next_timeout)
|
||||
{
|
||||
GTimeVal source_time;
|
||||
GSource *source = (GSource *) pool;
|
||||
gint64 now;
|
||||
|
||||
g_source_get_current_time (&pool->source, &source_time);
|
||||
now = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
|
||||
#if GLIB_CHECK_VERSION (2, 27, 3)
|
||||
now = g_source_get_time (source) / 1000;
|
||||
#else
|
||||
{
|
||||
GTimeVal source_time;
|
||||
g_source_get_current_time (source, &source_time);
|
||||
now = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _clutter_timeout_interval_prepare (now,
|
||||
&timeout->interval,
|
||||
|
Reference in New Issue
Block a user