Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members

# ptc::Timer Class Reference

A high resolution timer. More...

List of all members.

## Public Members

- Timer ()
- Timer (double time)
- Timer (const Timer &timer)
- ~Timer ()
- void set (double time)
- void start ()
- void stop ()
- double time ()
- double delta ()
- double resolution ()
- Timer& operator= (const Timer &timer)
- bool operator== (const Timer &timer) const
- bool operator!= (const Timer &timer) const

## Detailed Description

A high resolution timer.

The timer class represents a high resolution system timer.

Timer objects may be created and started then queried for the current time value in seconds.

This is useful for animations because motion can be based upon a high resolution real 't' value instead of being linked to the speed of the machine.

## Member Function Documentation

### ptc::Timer::Timer ()

Default constructor.

Sets the time value to zero.

### ptc::Timer::Timer (double time)

Creates a timer object with the time value initially set to time.

Parameters:
  time - the initial time value in seconds.

### ptc::Timer::Timer (const Timer & timer)

Copy constructor.

### ptc::Timer::~Timer ()

Destructor.

### void ptc::Timer::set (double time)

Sets the timer time value to time.

The time value may be set whether the timer is running or not.

Parameters:
  time - the time value in seconds.

### void ptc::Timer::start ()

Starts the timer.

When the timer is initially created it is not running.

Use this function to start the timer when you are ready to begin using it.

### void ptc::Timer::stop ()

Stops the timer.

### double ptc::Timer::time ()

Gets the current time value of the timer in seconds.

While the timer is running the time value increases as time passes.

When the timer is stopped the time value is constant.

See also:
  Timer::start() Timer::stop()

Returns:
  The current time value.

### double ptc::Timer::delta ()

Gets the amount of time that has passed since the last call to delta in seconds.

While the timer is running the delta value is typically a small value limited to the resolution of the timer.

When the timer is stopped the delta value is always zero.

See also:
  Timer::start() Timer::stop() Timer::resolution()

Returns:
  The current delta value.

### double ptc::Timer::resolution ()

Gets the limiting resolution of the timer in seconds.

The timer resolution is the smallest increment of time which the system timer can handle.

Returns:
  The timer resolution.

### Timer & ptc::Timer::operator= (const Timer & timer)

Assignment operator.

### bool ptc::Timer::operator== (const Timer & timer) const

Equality operator.

### bool ptc::Timer::operator!= (const Timer & timer) const

Inequality operator.

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

- ptc.h