Fix timer errors

This commit is contained in:
Anton Bulakh 2021-11-22 12:24:20 +02:00
parent e7a21947e6
commit e64446082b
No known key found for this signature in database
GPG Key ID: D666799AFFD8502A
1 changed files with 2 additions and 1 deletions

View File

@ -91,7 +91,8 @@ function timer:start()
gdebug.print_error(traceback("timer already started"))
return
end
self.data.source_id = glib.timeout_add(glib.PRIORITY_DEFAULT, self.data.timeout * 1000, function()
local timeout_ms = math.floor(self.data.timeout * 1000 + 0.5)
self.data.source_id = glib.timeout_add(glib.PRIORITY_DEFAULT, timeout_ms, function()
protected_call(self.emit_signal, self, "timeout")
return true
end)