Timer not accurate

Hey guys,

I am trying to use two timers, one to counts seconds and one to count milliseconds. However, when I print the output from both, which started at the same time, they don’t match up, and one goes faster than the other. This is the same when I change milliseconds 1/100ths or 1/50ths. Here is the code:

[lua]

local seconds = 0

timer.performWithDelay(1000, 

        function()

                seconds = seconds + 1

        end, 0)

local milleseconds = 0

timer.performWithDelay(1, 

        function()

                milleseconds = milleseconds + 1

                print(seconds, milleseconds)

        end, 0)

[/lua]

Why would you want to count miliseconds and not simply use something like system timer?

[lua]

print( system.getTimer() ) – displays the time running (in milliseconds)

[/lua]

Daniel

Why would you want to count miliseconds and not simply use something like system timer?

[lua]

print( system.getTimer() ) – displays the time running (in milliseconds)

[/lua]

Daniel