Returns the current high-precision time as an int64.
This can be used in comparing between two high-precision time values.
Returns the deltaTime (amount of time in seconds [including fractions] since last cycle) for the current logic cycle.
This is the same as the value passed to every call of macro.main().
This is often useful for any calculations that you want based on time; for example if you were to calculate the movement of an object, you would want to multiply it's speed by the deltaTime to see how much distance it should have moved within this "frame." Doing this will "smooth out" the stutter that can be caused by a variable logic rate, and ensure that the object moves at the same rate across all computers.
Compares two high-precision time values (from time.getNow()) and returns the amount of time that has elapsed between them in seconds (including fractions).
If only 't1' is given, then it returns the time that has elapsed between 't1' and now.
One practical use of this function is calculating exactly how long it takes to run a function. By checking which of your functions are slow, you know which ones to focus optimization on. This is called 'profiling.'
Page last updated at 2018-09-25 20:48:49