GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::G::Timer Class Reference

A GTimer C++ wrapper interface. More...

#include <gfc/glib/timer.hh>

Inheritance diagram for GFC::G::Timer:

GFC::Object GFC::Trackable List of all members.

Public Member Functions

Constructors
Accessors
Methods

Detailed Description

A GTimer C++ wrapper interface.

Timer 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 Timer provides a portable and convenient interface.

There is not much you can do with a timer. You can construct it, start() it running, stop() it running, and reset() it to zero.


Member Function Documentation

double GFC::G::Timer::elapsed unsigned long *  microseconds = 0  ) 
 

Obtains the elapsed time.

Parameters:
microseconds The fractional part of seconds elapsed, in microseconds, or null.
Returns:
The seconds elapsed as a floating point value, including any fractional part.

If a timer has been started but not stopped this method obtains the time since the timer was started. If timer has been stopped it 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. If microseconds is non-null, it will be set to the microseconds fraction of the elapsed time. It does not contain the seconds. The microseconds out parameter is not very useful.

void GFC::G::Timer::reset  ) 
 

Reset an already started timer to zero.

It's fine to call start() on an already-started timer to reset the start time, so reset() serves no real purpose, other than to make the intentions of your code a bit clearer.

void GFC::G::Timer::resume  ) 
 

Resumes a timer that has previously been stopped with stop().

Note stop() must be called before using this function.

void GFC::G::Timer::start  ) 
 

Marks a start time, so that future calls to elapsed() will report the time since start() was called.

When you construct a new timer this method automatically marks the start time, so there is no need to call start() immediately after constructing the timer.


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:04:58 2004 for GFC-Core by doxygen 1.3.8