Timer

Opaque datatype that records a start time.

Constructors

this
this(GTimer* gTimer, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new timer, and starts timing (i.e. Timer.start is implicitly called for you).

Members

Functions

continue_
void continue_()

Resumes a timer that has previously been stopped with Timer.stop. Timer.stop must be called before using this function.

destroy
void destroy()

Destroys a timer, freeing associated resources.

elapsed
double elapsed(gulong* microseconds)

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. The return value is the number of seconds elapsed, including any fractional part. The microseconds out parameter is essentially useless.

getStruct
void* getStruct()

the main Gtk struct as a void*

getTimerStruct
GTimer* getTimerStruct(bool transferOwnership)

Get the main Gtk struct

isActive
bool isActive()

Exposes whether the timer is currently active.

reset
void reset()

This function is useless; it's fine to call Timer.start on an already-started timer to reset the start time, so Timer.reset serves no purpose.

start
void start()

Marks a start time, so that future calls to Timer.elapsed will report the time since Timer.start was called. Timer.new automatically marks the start time, so no need to call Timer.start immediately after creating the timer.

stop
void stop()

Marks an end time, so calls to Timer.elapsed will return the difference between this end time and the start time.

Variables

gTimer
GTimer* gTimer;

the main Gtk struct