0 votes

ENG:
How can I check how many seconds have passed since the start of the script execution?
I need to make it so that I can check exactly how many seconds have passed since the function was executed. In my case, it is 2 seconds.
RUS:
Как я могу проверить, сколько секунд прошло с начала выполнения скрипта?
Мне нужно сделать так, чтобы я мог точно проверить, сколько секунд прошло с момента выполнения функции. В моем случае это 2 секунды

Thanks very much!

Godot version 3.3.1
in Engine by (44 points)

1 Answer

0 votes

Hi,
do you mean:

https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-get-ticks-usec

int get_ticks_msec ( ) const 

Returns the amount of time passed in milliseconds since the engine started.

or you just save this value and compare it to "now"

var start = OS.get_ticks_msec()
#then later
print( str(OS.get_ticks_msec()-start)+" have past since start" )
by (3,932 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.