mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Update OS to Time on pages containing OS.get_ticks_usec()
This commit is contained in:
@@ -137,11 +137,11 @@ use this snippet:
|
|||||||
|
|
||||||
.. code-block:: cpp
|
.. code-block:: cpp
|
||||||
|
|
||||||
uint64_t begin = OS::get_singleton()->get_ticks_usec();
|
uint64_t begin = Time::get_singleton()->get_ticks_usec();
|
||||||
|
|
||||||
// Your code here...
|
// Your code here...
|
||||||
|
|
||||||
uint64_t end = OS::get_singleton()->get_ticks_usec();
|
uint64_t end = Time::get_singleton()->get_ticks_usec();
|
||||||
print_line(vformat("Snippet took %d microseconds", end - begin));
|
print_line(vformat("Snippet took %d microseconds", end - begin));
|
||||||
|
|
||||||
This will print the time spent between the ``begin`` declaration and the ``end``
|
This will print the time spent between the ``begin`` declaration and the ``end``
|
||||||
|
|||||||
@@ -94,12 +94,12 @@ the following:
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
var time_start = OS.get_ticks_usec()
|
var time_start = Time.get_ticks_usec()
|
||||||
|
|
||||||
# Your function you want to time
|
# Your function you want to time
|
||||||
update_enemies()
|
update_enemies()
|
||||||
|
|
||||||
var time_end = OS.get_ticks_usec()
|
var time_end = Time.get_ticks_usec()
|
||||||
print("update_enemies() took %d microseconds" % time_end - time_start)
|
print("update_enemies() took %d microseconds" % time_end - time_start)
|
||||||
|
|
||||||
When manually timing functions, it is usually a good idea to run the function
|
When manually timing functions, it is usually a good idea to run the function
|
||||||
|
|||||||
Reference in New Issue
Block a user