<!-- Page: https://rustic-game-engine.pages.dev/docs/api/clock -->

# Clock

Scale or pause the shared scene clock for actions, animation, physics and audio.

[Feature status and language/platform compatibility](https://rustic-game-engine.pages.dev/markdown/reference/compatibility.md)

Choose an API to see its signature, parameters, examples and behavior.

## APIs

- [Clock.timeScale()](https://rustic-game-engine.pages.dev/markdown/api/clock/time-scale.md)
- [Clock.pause()](https://rustic-game-engine.pages.dev/markdown/api/clock/pause.md)
- [Clock.resume()](https://rustic-game-engine.pages.dev/markdown/api/clock/resume.md)
- [Clock.state()](https://rustic-game-engine.pages.dev/markdown/api/clock/state.md)

## Module guide

## Setup and language support

These engine-owned services work in Lua 5.4, Luau, JavaScript, Python, C, C++, C#, Java, PHP, and HTML inline JavaScript. Follow [Use gameplay actions](https://rustic-game-engine.pages.dev/markdown/guides/gameplay-actions.md) to create and attach a script, install external toolchains, and choose the correct language binding. PHP and HTML scripts belong under `ui/`; CSS alone runs no gameplay code.

The Calls section uses JavaScript signatures. The function examples below include native syntax for all ten script types, including SDK-specific alternatives and limitations. Attach a JavaScript Object Component script to the specified target and press **Play**. Globals are supplied by the engine. Schedule actions from `Start` or a callback, rather than at script top level. Native languages use typed options and their own builder conventions; see the guide's language bindings.

## Parameters

Scale is finite non-negative; 1 is normal rate and 0.5 is half speed. Clock.state() returns the current scale and paused flag in every gameplay language. C returns RusticClockState; C++ returns RusticValue; C# returns JsonElement; Java returns a map. C sets time scale with Clock.timeScale(value) and reads it with Clock.state().scale.

## Return and timing

TimeScale returns the resulting scale in JavaScript; state returns a synchronous clock snapshot. Pause/resume change global clock state rather than creating an operation handle.

## Behavior and limitations

- An anchored Part takes about four real seconds to finish the two-scene-second tween, then restores normal speed.
- Scaling applies to action/timer time, clip source clocks, physics and audio playback. Clip blend durations are scene-clock seconds.
- Clock.pause leaves script lifecycle callbacks available so a controller can call resume. A Timer alone cannot resume a paused clock because its own time is frozen.
- Play pause freezes the runtime; Stop discards it. Per-operation pause and voice.pause affect only their respective operation/voice.
- Check script attachment, enabled state and the Console when an operation fails. Asynchronous errors also appear in operation state. Callback exceptions disable the owner and clean up its actions.
- Owner destruction, disable, successful reload or Stop cleans up owned actions and subscriptions. Failed reload retains the previous behavior's operations. See [Operation handles](https://rustic-game-engine.pages.dev/markdown/api/operation-handles.md) for controls and lifetime details.
