## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csVirtualClock Class Reference

This is an implementation of a virtual clock. More...

`#include <csutil/virtclk.h>`

Inheritance diagram for csVirtualClock:

[legend]
List of all members.

## Public Member Functions

virtual void | Advance ()
| Advance the engine's virtual-time clock.
virtual csTicks | GetCurrentTicks () const
| Returns the absolute time of the last call to Advance().
virtual csTicks | GetElapsedTicks () const
| Query the time elapsed between the two most recent invocations of Advance().
virtual void | Resume ()
| Resume the engine's virtual-time clock.
virtual void | Suspend ()
| Suspend the engine's virtual-time clock.

## Detailed Description

This is an implementation of a virtual clock.

Using this clock you can easily keep track of elapsed and current time in a virtual setting.

Definition at line 35 of file virtclk.h.

## Member Function Documentation

virtual void csVirtualClock::Advance | ( |  | ) | `[virtual]`

| Advance the engine's virtual-time clock. Implements iVirtualClock.

virtual csTicks csVirtualClock::GetCurrentTicks | ( |  | ) | const`[inline, virtual]`

| Returns the absolute time of the last call to Advance(). For game logic you should always use this function instead of csGetTicks(). Implements iVirtualClock. Definition at line 66 of file virtclk.h.

virtual csTicks csVirtualClock::GetElapsedTicks | ( |  | ) | const`[inline, virtual]`

| Query the time elapsed between the two most recent invocations of Advance(). Implements iVirtualClock. Definition at line 65 of file virtclk.h.

virtual void csVirtualClock::Resume | ( |  | ) | `[virtual]`

| Resume the engine's virtual-time clock. Call this function when the client application begins invoking Advance() again after extended down-time. This function is the complement of Suspend(). Implements iVirtualClock.

virtual void csVirtualClock::Suspend | ( |  | ) | `[virtual]`

| Suspend the engine's virtual-time clock. Call this function when the client application will fail to call Advance() for an extended period of time. Suspending the virtual-time clock prevents a temporal anomaly from occurring the next time GetElapsedTicks() is called after the application resumes invoking Advance(). Implements iVirtualClock.

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

- csutil/virtclk.h