I would think that you would have issues trying to get milliseconds in this way.
My understanding of timer.preformWithDelay is that if the delay timer is less than the time between frames, then it will actually wait until the next frame to call the function (not sure if I’ve worded that simply enough).
If your game is running at 60fps, each frame is approx 16ms. If you want to set your timer to every 1/100 of a second, that would be 10ms. So if you were to just add .01 to your timer text, it would quickly be out of sync.
I would use the enterFrame function instead. Your timer won’t go up in single milliseconds (it will increase by however many ms have passed in each frame), but nobody would be able to read that fast anyway:
local prevFrameTime, currentFrameTime --both nil local deltaFrameTime = 0 local totalTime = 0 local txt\_counter = display.newText( totalTime, 0, 0, native.systemFont, 50 ) txt\_counter.x = 150 txt\_counter.y = 288 txt\_counter:setTextColor( 255, 255, 255 ) group:insert( txt\_counter )
local function enterFrame(e) local currentFrameTime = system.getTimer() --if this is still nil, then it is the first frame --so no need to perform calculation if prevFrameTime then --calculate how many milliseconds since last frame deltaFrameTime = currentFrameTime - prevFrameTime end prevFrameTime = currentFrameTime --this is the total time in milliseconds totalTime = totalTime + deltaFrameTime --multiply by 0.001 to get time in seconds txt\_counter.text = totalTime \* 0.001 end