## Public API Reference

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

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

# iVirtualClock Struct Reference

A virtual game clock. More...

`#include <iutil/virtclk.h>`

Inheritance diagram for iVirtualClock:

[legend]
List of all members.

## Public Member Functions

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

## Detailed Description

A virtual game clock.

Normally, a single instance of iVirtualClock is placed in the shared object registry (iObjectRegistry).

Main creators of instances implementing this interface:

- csInitializer::CreateEnvironment()
- csInitializer::CreateVirtualClock()

Main ways to get pointers to this interface:

- csQueryRegistry()

Definition at line 38 of file virtclk.h.

## Member Function Documentation

virtual void iVirtualClock::Advance | ( |  | ) | `[pure virtual]`

| Advance the engine's virtual-time clock. Implemented in csVirtualClock.

virtual csTicks iVirtualClock::GetCurrentTicks | ( |  | ) | const`[pure virtual]`

| Returns the absolute time of the last call to Advance(). For game logic you should always use this function instead of csGetTicks(). Implemented in csVirtualClock.

virtual csTicks iVirtualClock::GetElapsedTicks | ( |  | ) | const`[pure virtual]`

| Query the time elapsed between the two most recent invocations of Advance(). Implemented in csVirtualClock.

virtual void iVirtualClock::Resume | ( |  | ) | `[pure 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(). Implemented in csVirtualClock.

virtual void iVirtualClock::Suspend | ( |  | ) | `[pure 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(). Implemented in csVirtualClock.

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

- iutil/virtclk.h