Time

Functions for managing time and frame rate.


Get Delta

get_delta() float

Get the time elapsed since the last frame.

Returns

float : The delta time in seconds.

Note:

For stability, the returned delta is clamped so it will not be smaller than 1/12 seconds (equivalent to capping at 12 FPS). This prevents unstable calculations that rely on delta when very small frame times are measured. This will not, however, clamp the value returned by get_fps().

Get FPS

get_fps() float

Get the current frames per second (FPS) measurement.

Returns

float : The current FPS value.

Set Target

set_target(frame_rate: int) None

Set the target frame rate for the application.

Parameters

  • frame_rate : The desired frame rate in frames per second (FPS). Values ≤ 0 disable frame rate limiting.

Get Elapsed

get_elapsed() float

Get the total elapsed time since the application started.

Returns

float : The elapsed time in seconds.

Delay

delay(ms: float) None

Pause the application for a specified duration.

Parameters

  • ms : The amount of time to delay in milliseconds.

Note:

This function pauses execution for the given number of milliseconds — useful for simple timing control. Though, set_target() is generally preferred for precise frame rate control with nanosecond accuracy.