Kraken Logo

Kraken Engine

DocumentationGuidesShowcaseCommunity
Ctrl
K
Navigating the Docs
Building Docs
Overview
Camera
Color
Draw
Ease
Event
Fx
Gamepad
Input
Log
Math
Mixer
Mouse
Physics
Pixel Array
Renderer
Shaders
Time
Transform
Ui
Viewport
Window

Built bydurkisneer1.Kraken Engine is open source and available onGitHub.

  1. Docs
  2. Functions
  3. Time

Time

Time related functions


Get Delta

get_delta() → floatget_delta() → float

Get the time elapsed since the last frame in seconds.

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.

Returns

float : The time elapsed since the last frame, in seconds.

Set Max Delta

set_max_delta(max_delta: float) → Noneset_max_delta(max_delta: float) → None

Set the maximum allowed delta time between frames.

Args

  • max_delta : Maximum delta time in seconds (> 0.0). Use this to avoid large deltas during frame drops or pauses that could destabilize physics or animations.

Get Fps

get_fps() → floatget_fps() → float

Get the current frames per second of the program.

Returns

float : The current FPS based on the last frame time.

Set Target

set_target(frame_rate: int) → Noneset_target(frame_rate: int) → None

Set the target framerate for the application.

Args

  • frame_rate : Target framerate to enforce. Values <= 0 disable frame rate limiting.

Get Elapsed

get_elapsed() → floatget_elapsed() → float

Get the elapsed time since the program started.

Returns

float : The total elapsed time since program start, in seconds.

Delay

delay(milliseconds: int) → Nonedelay(milliseconds: int) → None

Delay the program execution for the specified duration.

This function pauses execution for the given number of milliseconds. Useful for simple timing control, though using time.set_cap() is generally preferred for precise frame rate control with nanosecond accuracy.

Args

  • milliseconds : The number of milliseconds to delay.

Set Scale

set_scale(scale: float) → Noneset_scale(scale: float) → None

Set the global time scale factor.

Args

  • scale : The time scale factor. Values < 0.0 are clamped to 0.0. A scale of 1.0 represents normal time, 0.5 is half speed, and 2.0 is double speed.

Get Scale

get_scale() → floatget_scale() → float

Get the current global time scale factor.

Returns

float : The current time scale factor.

PreviousShaders
NextTransform

On this page

Get DeltaSet Max DeltaGet FpsSet TargetGet ElapsedDelaySet ScaleGet Scale