Reference | Clock

This function controls the system clock.

PS.Clock ( ticks )

Starts and stops the engine clock, and establishes its pulse frequency.

Parameters:

  1. (optional) ticks : integer

Returns: integer

Default: 0 (clock disabled)

The optional ticks parameter specifies the clock pulse frequency, expressed in 60ths of a second.

If a PS.Tick() function is defined, that function is thereafter called every ticks 60ths of a second. The function doesn't have to do anything.

If the clock is not running, a call to PS.Clock() activates it. If the clock is already running, its frequency is changed to the specified value.

Any numeric value less than one (1) deactivates the clock.

A warning is issued if no PS.Tick() function is defined when PS.Clock() is called.

If no parameter is provided, the clock behavior is not changed.

The return value is the current frequency of the clock, zero (0) if disabled.

If a parameter error occurs, the value PS.ERROR is returned.