Countdown timer not counting correctly

HI

Can somebody help me fix my code it is just a countdown timer.

not counting correctly

days, hours, minutes, seconds

please help

–The number of days remaining
local dayText = display.newText( “”, 0, 0, native.systemFontBold, 40 )
dayText.x, dayText.y = 50, 50

–The number of hours remaining
local hourText = display.newText( “”, 0, 0, native.systemFontBold, 40 )
hourText.x, hourText.y = 125, 50

–The number of minutes remaining
local minutesText = display.newText( “”, 0, 0, native.systemFontBold, 40 )
minutesText.x, minutesText.y = 175, 50

–The number of minutes remaining
local secondsText = display.newText( “”, 0, 0, native.systemFontBold, 40 )
secondsText.x, secondsText.y = 225, 50

–Function to update the countdown clock
local function updateTime()
local time = os.date("*t")

local daysLeft = 358 - time.yday
if (daysLeft < 10) then
daysLeft = “0” … daysLeft
end
dayText.text = daysLeft

local hoursLeft = 23 - time.hour
if (hoursLeft < 10) then
hoursLeft = “0” … hoursLeft
end
hourText.text = hoursLeft

local minutesLeft = 60 - time.min
if (minutesLeft < 10) then
minutesText = “0” … minutesLeft
end
minutesText.text = minutesLeft

local secondsLeft = 60 - time.sec
if (secondsLeft < 10) then
secondsText = “0” … secondsLeft
end
secondsText.text = secondsLeft

end

–Update the time once immediately to display the correct time
updateTime()

– Update the clock once per second
local clockTimer = timer.performWithDelay( 1000, updateTime, -1 )

if you change from 1000 to 10 like this?

local clockTimer = timer.performWithDelay( 10, updateTime, -1 )

does it still count wrong?

nevermind, tried to run it and there are other issues.

its a simple block of code so you should step through the logic and figure this one out yourself.

best way to learn.

if you change from 1000 to 10 like this?

local clockTimer = timer.performWithDelay( 10, updateTime, -1 )

does it still count wrong?

nevermind, tried to run it and there are other issues.

its a simple block of code so you should step through the logic and figure this one out yourself.

best way to learn.