0 votes

Hello
I'm what for my game an online hour because if I use the OS one the could change the time of the computer or phone.
Someone knows how to do it.
Thanks

in Engine by (23 points)

1 Answer

0 votes

One way to do it is get the time from online NTP servers. Example https://www.ntppool.org/en/

Another way could be to use a timer node. At the start of your code capture the ticks and then use timer to keep track of a counter. Compare the sum to the current ticks. If the sum hasn't drifted by much just reset the start ticks to current ticks otherwise produce error.

https://gdscript.com/solutions/godot-timing-tutorial/

by (795 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 Frequently asked questions and 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.