Game time, wall time, tick intervals and unit conversion.
26 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types ).
$ time . decomposed_duration_to_seconds (days: int , hours: int , minutes: int , seconds: int ) -> int
Given a duration in days, hours, minutes, seconds, return the duration in seconds.
Parameter Type Meaning daysintCount of days in the time duration hoursintCount of hours in the time duration minutesintCount of minutes in the time duration secondsintCount of seconds in the time duration
Returns int: The duration in seconds.
$ time . get_decomposed_date () -> list
Return the decomposed date in a list formatted as [year, month, day, hour, minute, second].
Returns list: The decomposed date in the format [year, month, day, hour, minute, second].
$ time . get_decomposed_time_value_list (time: int ) -> list
Given a time in seconds, return the decomposed time in a list formatted as [days, hours, minutes, seconds].
Parameter Type Meaning timeintThe time in seconds to decompose.
Returns list: The decomposed time values in the format [days, hours, minutes, seconds].
$ time . get_decomposed_time_value_list_ms (time_ms: int ) -> list
Given a time in seconds, return the decomposed time in a list formatted as [days, hours, minutes, seconds].
Parameter Type Meaning time_msintThe time in milliseconds to decompose.
Returns list: The decomposed time values in the format [days, hours, minutes, seconds].
$ time . get_gameplay_tick_interval () -> float
Get the gameplay time in seconds between frames from global_time.vscript singleton. If global_time does not exist, returns the same value as get_tick_interval().
Returns float: Time in seconds.
$ time . get_gameplay_tick_interval_ms () -> int
Get the gameplay time in milliseconds between frames from global_time.vscript singleton. If global_time does not exist, returns the same value as get_tick_interval_ms().
Returns int: Time in milliseconds.
$ time . get_gameplay_time_ms () -> int
Get the current gameplay time in milliseconds from global_time.vscript singleton.
Returns int: Time in milliseconds.
$ time . get_gpu_actual_time () -> float
Get the actual previous frame time for the GPU.
Returns float: Time in seconds.
$ time . get_out_actual_time () -> float
Get the actual previous frame time for output.
Returns float: Time in seconds.
$ time . get_out_target_time () -> float
Get the desired max frame time for output.
Returns float: Time in seconds.
$ time . get_sim_actual_time () -> float
Get the actual previous frame time for the simulation.
Returns float: Time in seconds.
$ time . get_sim_frame_index () -> int
Get the increment-only sim frame index
Returns int: frame index, may be 0 for first frame
$ time . get_sim_frame_time_base () -> float
Returns the base sim frame time in seconds. This is the duration of a frame on the server. Clients may have it altered by time.get_sim_frame_time_scale().
Returns float: Base sim frame time in seconds.
$ time . get_sim_frame_time_scale () -> float
Returns the sim frame time scale factor. On a client, this may scale time.get_sim_frame_time_base() to reduce ticks and improve performance.
Returns float: Base sim time multiplier.
$ time . get_sim_ring_commit_success_frame_index () -> int
Get last sim frame index where a ring commit was successful
Returns int: last sim frame index where a ring commit was successful
$ time . get_sim_target_time () -> float
Get the desired max frame time for the simulation.
Returns float: Time in seconds.
$ time . get_system_time_ms () -> int
Get the system time in milliseconds at the start of this frame.
Returns int: Time in milliseconds.
$ time . get_tick_interval () -> float
Get the time in seconds between frames.
Returns float: Time in seconds.
$ time . get_tick_interval_ms () -> int
Get the time in milliseconds between frames.
Returns int: Time in milliseconds.
$ time . get_time_ms () -> int
Get the current time since app startup in milliseconds.
Returns int: Time in milliseconds.
$ time . get_virtual_time () -> int
Get the current virtual time (frame number).
Returns int: Time in frames.
$ time . get_virtual_time_of_last_draw () -> int
Get the virtual time of the previous frame with a draw event. This is not rollback safe. This may be < current virtual time - 1 if the client fell behind and rolled forth to catch up, skipping leading edge frames.
Returns int: Time in frames.
$ time . invalidate_gameplay_time_cache ()
Invalidate cached gameplay times. Called by global_time.vscript when tick interval scale changes.
$ time . ms_to_seconds (ms: int ) -> float
Convert a time duration in milliseconds to seconds. Safe only for time durations, not absolute clock values.
Parameter Type Meaning msintTime in milliseconds.
Returns float: Time in seconds.
$ time . seconds_to_ms (seconds: float ) -> int
Convert a time duration in seconds to milliseconds. Safe only for time durations, not absolute clock values.
Parameter Type Meaning secondsfloatTime in seconds.
Returns int: Time in milliseconds.
$ time . utc_s_to_decomposed_date (utc_s: int ) -> list
Return the decomposed date of a utc timestamp in a list formatted as [year, month, day, hour, minute, second].
Parameter Type Meaning utc_sintThe time in seconds utc to decompose.
Returns list: The decomposed date in the format [year, month, day, hour, minute, second].