GLib Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <glib.h> struct GTimer; GTimer* g_timer_new (void); void g_timer_start (GTimer *timer); void g_timer_stop (GTimer *timer); gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds); void g_timer_reset (GTimer *timer); void g_timer_destroy (GTimer *timer); |
Timers can be used to time operations, in a similar way to a stopwatch. Call g_timer_new() to create the timer, g_timer_start() to start it, g_timer_elapsed() to determine the time which has elapsed since the timer was started, and g_timer_stop() to stop the timer.
gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds); |
timer : | the timer. |
microseconds : | if non-NULL, this will be set to the microseconds component of the elapsed time (it does not include the number of seconds elapsed). |
Returns : | the elapsed time in seconds, as a double. |
void g_timer_reset (GTimer *timer); |
Resets the elapsed time to 0, leaving the timer running.
timer : | the timer. |
void g_timer_destroy (GTimer *timer); |
Destroys the timer, freeing the memory allocated for it.
timer : | the timer. |