Project:DUI

Class List Class Hierarchy
Summary: Ctors Methods Mixins

Module dglib.TimerG

Class TimerG

Implemented interfaces:


public class

TimerG



TimerG records a start time, and counts microseconds elapsed since that time.
This is done somewhat differently on different platforms, and can be tricky to get exactly right, so TimerG provides a portable/convenient interface.

Constructor Summary
public ()
          Creates a new TimerG.
(GTimer *gTimer)
          Creates a TimerG from a GTimer

Methods Summary
~this ()
          Destroy our gTimer
void start()
          Marks a start time, so that future calls to gTimerElapsed() will report the time since start() was called.
void stop()
          Marks an end time, so calls to elapsed() will return the difference between this end time and the start time.
void resume()
          Resumes a timer that has previously been stopped with stop().
gdouble elapsed(gulong microseconds)
          If timer has been started but not stopped, obtains the time since the timer was started.
void reset()
          This function is useless; it's fine to call start() on an already-started timer to reset the start time, so reset() serves no purpose.




public ctor(TimerG)()
Creates a new TimerG.



ctor(TimerG)(GTimer *gTimer)
Creates a TimerG from a GTimer

Parameters:
*gTimer - the glib struct timer pointer



~this ()
Destroy our gTimer

start

void start()
Marks a start time, so that future calls to gTimerElapsed() will report the time since start() was called.
Creating a new TimerG automatically marks the start time, so no need to call gTimerStart() immediately after creating the timer.

stop

void stop()
Marks an end time, so calls to elapsed() will return the difference between this end time and the start time.

resume

void resume()
Resumes a timer that has previously been stopped with stop().
stop() must be called before using this function.

elapsed

gdouble 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.

Parameters:
microseconds - fractional part of seconds elapsed, in microseconds (that is, the total number of microseconds elapsed, modulo 1000000)

Returns:
seconds elapsed as a floating point value, including any fractional part.

reset

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