minetest.get_us_time

From Minetest Developer Wiki
Revision as of 21:09, 9 May 2015 by Prestidigitator (talk | contribs) (→‎Description: (last edit and this:) Information retrieved from lua_api.txt and from in-game testing.)
Jump to navigation Jump to search

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;