util/timer.lua
changeset 8765 2f8523bf7ff2
parent 8688 2548111e71d6
child 8998 2e6f7ab97794
--- a/util/timer.lua	Wed Apr 25 11:55:03 2018 +0100
+++ b/util/timer.lua	Sun Apr 29 21:43:39 2018 +0100
@@ -15,6 +15,7 @@
 local debug_traceback = debug.traceback;
 local tostring = tostring;
 local xpcall = xpcall;
+local math_max = math.max;
 
 local _ENV = nil;
 -- luacheck: std none
@@ -87,7 +88,7 @@
 		next_time = peek;
 		_server_timer:close();
 		if next_time ~= nil then
-			_server_timer = _add_task(next_time - get_time(), _on_timer);
+			_server_timer = _add_task(math_max(next_time - get_time(), 0), _on_timer);
 		end
 	end
 	return result, item, result_sync;