Difference between revisions of "minetest.get us time"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:minetest.get_us_time}} == Syntax == <source>minetest.get_us_time()</source> == Description == returns time with microsecond precision. This does not seem to b...")
 
(→‎Description: (last edit and this:) Information retrieved from lua_api.txt and from in-game testing.)
Line 4: Line 4:
  
 
== Description ==
 
== Description ==
returns time with microsecond precision.  This does not seem to be strictly related to [[minetest.get_gametime|game time]] or [[timeofday|time of day]] in a meaningful way, but should be useful for taking differences in time measured during a single execution of the server.  For example, it can be useful for profiling mod performance.
+
Returns time with microsecond precision.  This does not seem to be strictly related to [[minetest.get_gametime|game time]] or [[timeofday|time of day]] in a meaningful way, but should be useful for taking differences in time measured during a single execution of the server.  For example, it can be useful for profiling mod performance.
  
 
== Example ==
 
== Example ==

Revision as of 21:09, 9 May 2015

Syntax

minetest.get_us_time()

Description

Returns time with microsecond precision. This does not seem to be strictly related to game time or time of day in a meaningful way, but should be useful for taking differences in time measured during a single execution of the server. For example, it can be useful for profiling mod performance.

Example

local t0_us = minetest.get_us_time();
-- ...
local t1_us = minetest.get_us_time();
local elapsed_time_in_seconds = (t1_us - t0_us)/1000000.0;