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:
Emmanuele Bassi
2010-11-07 16:20:51 +00:00
parent 68d7a5e847
commit 8f60d5a3a2
4 changed files with 49 additions and 18 deletions

View File

@ -144,11 +144,17 @@ clutter_frame_source_prepare (GSource *source,
gint *delay)
{
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
GTimeVal source_time;
gint64 current_time;
g_source_get_current_time (source, &source_time);
current_time = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
#if GLIB_CHECK_VERSION (2, 27, 3)
current_time = g_source_get_time (source) / 1000;
#else
{
GTimeVal source_time;
g_source_get_current_time (source, &source_time);
current_time = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
}
#endif
return _clutter_timeout_interval_prepare (current_time,
&frame_source->timeout,