/src/wrappers/glib/library/utilities/g_timer.e
http://github.com/tybor/Liberty · Specman e · 68 lines · 44 code · 13 blank · 11 comment · 0 complexity · 024c6c48e91d5a0eda0d452ac391f947 MD5 · raw file
- indexing
- copyright: "(C) 2005 Paolo Redaelli "
- license: "LGPL v2 or later"
- date: "$Date:$"
- revision: "$REvision:$"
- class G_TIMER
- inherit C_STRUCT redefine default_create end
- insert GTIMER_EXTERNALS undefine default_create end
- -- creation make
- feature {} --
- struct_size: INTEGER is
- external "C inline use <glib.h>"
- alias "sizeof(GTimer)"
- end
- feature -- Creation
- default_create is --, make is
- -- Creates a new timer, and starts timing
- do
- handle := g_timer_new
- end
-
- dispose is
- do
- g_timer_destroy (handle)
- handle := default_pointer
- end
-
- feature
- start is
- -- (Re)starts timing
- do
- g_timer_start(handle)
- end
- stop is
- -- Marks an end time
- do
- g_timer_stop (handle)
- end
- continue is
- -- Resumes a timer that has previously been stopped
- require
- -- TODO is_stopped
- do
- g_timer_continue (handle)
- end
- elapsed: REAL is
- -- If timer has been started but not stopped, obtains the
- -- time since the timer was started. If timer has been
- -- stopped, obtains the elapsed time between the time it was
- -- started and the time it was stopped. Result unit is
- -- seconds elapsed, including any fractional part
- local
- microseconds: REAL
- do
- Result:= g_timer_elapsed (handle, $microseconds)
- end
- end