# cPrecisionClock Class Reference
[Timers]

cPrecisionClock provides a class to manage high-precision time measurements. All measurements are in seconds unless otherwise-specified. More...

`#include <CPrecisionClock.h>`

List of all members.

## Public Member Functions
| cPrecisionClock ()
| Constructor of cPrecisionClock.
| ~cPrecisionClock ()
| Destructor of cPrecisionClock.
void | reset ()
| Reset clock to zero.
double | start (bool a_resetClock=false)
| Start counting time; optionally reset the clock to zero.
double | stop ()
| Stop counting time; return the elapsed time.
bool | on ()
| Return true if timer is currently on, else return false.
double | getCurrentTimeSeconds ()
| Read the current clock time (seconds) (the time that has elapsed since the last call to "start").
void | setTimeoutPeriodSeconds (double a_timeoutPeriod)
| Set the period before a "timeout" occurs (you need to poll for this).
double | getTimeoutPeriodSeconds ()
| Read the programmed timeout period.
bool | timeoutOccurred ()
| Returns true if a timeout has occurred.
bool | highResolution ()
| Returns true if high resolution timers are available on this computer.
double | getCPUTimeSeconds ()
| If all you want is something that tells you the time, this is your function...
double | getCPUTime ()
| For backwards-compatibility...
double | getCPUtime ()
| For backwards-compatibility...

## Detailed Description

cPrecisionClock provides a class to manage high-precision time measurements. All measurements are in seconds unless otherwise-specified.

## Constructor & Destructor Documentation

cPrecisionClock::cPrecisionClock | ( |  | ) |

Constructor of cPrecisionClock.

Constructor of cPrecisionClock. Clock is initialized to zero.

## Member Function Documentation

long cPrecisionClock::getCPUtime | ( |  | ) | `[inline]`

For backwards-compatibility...

If all you want is something that tells you the time, this is your function...

Returns:
  Return cpu clock in seconds.

double cPrecisionClock::getCurrentTimeSeconds | ( |  | ) |

Read the current clock time (seconds) (the time that has elapsed since the last call to "start").

Read the current time of timer. Result is returned in seconds.

Returns:
  Return current time in seconds

void cPrecisionClock::reset | ( | void |  | ) |

Reset clock to zero.

Reset the clock to zero.

void cPrecisionClock::setTimeoutPeriodSeconds | ( | double | a_timeoutPeriod | ) |

Set the period before a "timeout" occurs (you need to poll for this).

Set the period in microseconds before timeout occurs. Do not forget to set the timer on by calling method start()

Parameters:

  | a_timeoutPeriod | Timeout period in seconds.

double cPrecisionClock::start | ( | bool | a_resetClock = `false` | ) |

Start counting time; optionally reset the clock to zero.

Start the clock from its current time value. To read the latest time from the clock, use method getCurrentTime.

Parameters:

  | a_resetClock | Should we start counting from zero?

Returns:
  Returns the current clock time.

double cPrecisionClock::stop | ( |  | ) |

Stop counting time; return the elapsed time.

Stop the timer. To resume counting call start().

Returns:
  Return time in seconds.

bool cPrecisionClock::timeoutOccurred | ( |  | ) |

Returns true if a timeout has occurred.

Check if timer has expired its timeout period. if so return true.

Returns:
  Return true if timeout occurred, otherwise false.

The documentation for this class was generated from the following files:

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/timers/CPrecisionClock.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/timers/CPrecisionClock.cpp

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.