utils.timer

Returns the high-resolution timer output

Prototype

secs = utils.timer ( )

Description

This returns the current output from the high-resolution timer (exactly the same as GetInfo (232) ). However this is easier to remember than GetInfo (232) every time you want to time some code.

If the high-performance timer is not available then the output from the lower-resolution timer is returned instead (seconds since midnight (00:00:00), January 1, 1970).

The intention of this is to allow you to time events, for example:

start = utils.timer ()

-- do stuff here

time_taken = utils.timer () - start

Lua functions

Topics