mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-25 03:32:12 +01:00
Document g_timeout_add_seconds first call latency
And fix /timeout/rounding to not fail if the first call happens after 2 seconds. https://bugzilla.gnome.org/show_bug.cgi?id=644552
This commit is contained in:
parent
cd72732835
commit
7fc46fa278
@ -4119,6 +4119,10 @@ g_timeout_add_seconds_full (gint priority,
|
|||||||
* using g_source_attach(). You can do these steps manually if you need
|
* using g_source_attach(). You can do these steps manually if you need
|
||||||
* greater control. Also see g_timout_add_seconds_full().
|
* greater control. Also see g_timout_add_seconds_full().
|
||||||
*
|
*
|
||||||
|
* Note that the first call of the timer may not be precise for timeouts
|
||||||
|
* of one second. If you need finer precision and have such a timeout,
|
||||||
|
* you may want to use g_timeout_add() instead.
|
||||||
|
*
|
||||||
* Return value: the ID (greater than 0) of the event source.
|
* Return value: the ID (greater than 0) of the event source.
|
||||||
*
|
*
|
||||||
* Since: 2.14
|
* Since: 2.14
|
||||||
|
@ -53,6 +53,12 @@ test_func (gpointer data)
|
|||||||
|
|
||||||
current_time = g_get_monotonic_time ();
|
current_time = g_get_monotonic_time ();
|
||||||
|
|
||||||
|
/* We accept 2 on the first iteration because _add_seconds() can
|
||||||
|
* have an initial latency of 1 second, see its documentation.
|
||||||
|
*/
|
||||||
|
if (count == 0)
|
||||||
|
g_assert (current_time / 1000000 - last_time / 1000000 <= 2);
|
||||||
|
else
|
||||||
g_assert (current_time / 1000000 - last_time / 1000000 == 1);
|
g_assert (current_time / 1000000 - last_time / 1000000 == 1);
|
||||||
|
|
||||||
last_time = current_time;
|
last_time = current_time;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user