Use gmath.round
This commit is contained in:
parent
e963d37cc4
commit
71d08ab6ec
|
@ -61,6 +61,7 @@ local glib = require("lgi").GLib
|
|||
local object = require("gears.object")
|
||||
local protected_call = require("gears.protected_call")
|
||||
local gdebug = require("gears.debug")
|
||||
local gmath = require("gears.math")
|
||||
|
||||
--- Timer objects. This type of object is useful when triggering events repeatedly.
|
||||
-- The timer will emit the "timeout" signal every N seconds, N being the timeout
|
||||
|
@ -91,7 +92,7 @@ function timer:start()
|
|||
gdebug.print_error(traceback("timer already started"))
|
||||
return
|
||||
end
|
||||
local timeout_ms = math.floor(self.data.timeout * 1000 + 0.5)
|
||||
local timeout_ms = gmath.round(self.data.timeout * 1000)
|
||||
self.data.source_id = glib.timeout_add(glib.PRIORITY_DEFAULT, timeout_ms, function()
|
||||
protected_call(self.emit_signal, self, "timeout")
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue