gre.ustime() gre.ustime(app_relative)
Retrieve the current time in microseconds. This call provides a higher resolution than the standard Lua os.clock()
or os.date()
functions.
When true
is passed in as an argument, the time returned is relative to the application start time and aligned with the timestamps that are generated by the Storyboard logging API.
Returns: The current time in microseconds in a system specific manner (gre.ustime()) or the time in microseconds since the start of the application (gre.ustime(true)) Example:
-- Time an operation local s = gre.ustime() my_function() local e = gre.ustime() print("my_function took " .. tostring(e - s) .. "us") -- Determine how long from app start to this point local delta = gre.ustime(true) print(string.format("Application start to now: %d us", delta)