Improve 'wait_for_ticks' handling of system clock changes (#1035)

This commit is contained in:
Tim Wilkinson 2023-12-19 12:07:11 -08:00 committed by GitHub
parent a388adaa79
commit bd26116e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -51,7 +51,16 @@ if nixio.sysinfo().totalram < 32 * 1024 * 1024 then
end end
function wait_for_ticks(ticks) function wait_for_ticks(ticks)
coroutine.yield(ticks) local when = nixio.sysinfo().uptime + ticks
while true
do
ticks = when - nixio.sysinfo().uptime
if ticks > 0 then
coroutine.yield(ticks)
else
break
end
end
end end
function exit_app() function exit_app()