Skip to main content
Version: 9.0.2

gre.mstime

gre.mstime()
--OR
gre.mstime(app_relative)

Retrieve the current time in milliseconds in the default, no argument flavour. This call provides a higher resolution than the standard Lua os.clock()or os.date() functions.

Parameters

ParameterTypeDescription
app_relative#boolean[Optional] When true is passed in as an argument, then the time returned will be relative to the application start time and aligned with the timestamps that are generated by the Storyboard logging API.

Returns

TypeDescription
#numberThe current time in milliseconds in a system specific manner (gre.mstime()) or the time in milliseconds since the start of the application (gre.mstime(true))

Example

-- Time an operation
local s = gre.mstime()
my_function()
local e = gre.mstime()
print("my_function took " .. tostring(e - s) .. "ms")

-- Determine how long from app start to this point
local delta = gre.mstime(true)
print(string.format("Application start to now: %d ms", delta))