mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 00:06:24 +01:00
Merge branch 'master' into 'master'
Add g_timer_is_active Closes #1794 See merge request GNOME/glib!929
This commit is contained in:
commit
1bd72404ba
@ -1265,6 +1265,7 @@ g_timer_continue
|
|||||||
g_timer_elapsed
|
g_timer_elapsed
|
||||||
g_timer_reset
|
g_timer_reset
|
||||||
g_timer_destroy
|
g_timer_destroy
|
||||||
|
g_timer_is_active
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
@ -236,6 +236,23 @@ g_timer_elapsed (GTimer *timer,
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_timer_is_active:
|
||||||
|
* @timer: a #GTimer.
|
||||||
|
*
|
||||||
|
* Exposes whether the timer is currently active.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the timer is running, %FALSE otherwise
|
||||||
|
* Since: 2.62
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
g_timer_is_active (GTimer *timer)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (timer != NULL, FALSE);
|
||||||
|
|
||||||
|
return timer->active;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_usleep:
|
* g_usleep:
|
||||||
* @microseconds: number of microseconds to pause
|
* @microseconds: number of microseconds to pause
|
||||||
|
@ -56,6 +56,8 @@ void g_timer_continue (GTimer *timer);
|
|||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
gdouble g_timer_elapsed (GTimer *timer,
|
gdouble g_timer_elapsed (GTimer *timer,
|
||||||
gulong *microseconds);
|
gulong *microseconds);
|
||||||
|
GLIB_AVAILABLE_IN_2_62
|
||||||
|
gboolean g_timer_is_active (GTimer *timer);
|
||||||
|
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
void g_usleep (gulong microseconds);
|
void g_usleep (gulong microseconds);
|
||||||
|
@ -98,6 +98,22 @@ test_timer_reset (void)
|
|||||||
g_timer_destroy (timer);
|
g_timer_destroy (timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_timer_is_active (void)
|
||||||
|
{
|
||||||
|
GTimer *timer;
|
||||||
|
gboolean is_active;
|
||||||
|
|
||||||
|
timer = g_timer_new ();
|
||||||
|
is_active = g_timer_is_active (timer);
|
||||||
|
g_assert_true (is_active);
|
||||||
|
g_timer_stop (timer);
|
||||||
|
is_active = g_timer_is_active (timer);
|
||||||
|
g_assert_false (is_active);
|
||||||
|
|
||||||
|
g_timer_destroy (timer);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_timeval_add (void)
|
test_timeval_add (void)
|
||||||
{
|
{
|
||||||
@ -282,6 +298,7 @@ main (int argc, char *argv[])
|
|||||||
g_test_add_func ("/timer/stop", test_timer_stop);
|
g_test_add_func ("/timer/stop", test_timer_stop);
|
||||||
g_test_add_func ("/timer/continue", test_timer_continue);
|
g_test_add_func ("/timer/continue", test_timer_continue);
|
||||||
g_test_add_func ("/timer/reset", test_timer_reset);
|
g_test_add_func ("/timer/reset", test_timer_reset);
|
||||||
|
g_test_add_func ("/timer/is_active", test_timer_is_active);
|
||||||
g_test_add_func ("/timeval/add", test_timeval_add);
|
g_test_add_func ("/timeval/add", test_timeval_add);
|
||||||
g_test_add_func ("/timeval/from-iso8601", test_timeval_from_iso8601);
|
g_test_add_func ("/timeval/from-iso8601", test_timeval_from_iso8601);
|
||||||
g_test_add_func ("/timeval/to-iso8601", test_timeval_to_iso8601);
|
g_test_add_func ("/timeval/to-iso8601", test_timeval_to_iso8601);
|
||||||
|
Loading…
Reference in New Issue
Block a user