diff net/server_select.lua @ 14078:d649d011df45

Use util.time.now() consistently instead of socket.gettime()
author Link Mauve <linkmauve@linkmauve.fr>
date Fri, 30 Jan 2026 14:08:53 +0100
parents a4c47203a9eb
children
line wrap: on
line diff
--- a/net/server_select.lua	Fri Feb 13 16:19:12 2026 +0100
+++ b/net/server_select.lua	Fri Jan 30 14:08:53 2026 +0100
@@ -48,7 +48,7 @@
 --// extern libs //--
 
 local luasocket = use "socket" or require "socket"
-local luasocket_gettime = luasocket.gettime
+local time_now = require "prosody.util.time".now;
 local inet = require "prosody.util.net";
 local inet_pton = inet.pton;
 local sslconfig = require "prosody.util.sslconfig";
@@ -919,7 +919,7 @@
 	local new_data = {};
 
 	function add_task(delay, callback)
-		local current_time = luasocket_gettime();
+		local current_time = time_now();
 		delay = delay + current_time;
 		if delay >= current_time then
 			table_insert(new_data, {delay, callback});
@@ -970,7 +970,7 @@
 loop = function(once) -- this is the main loop of the program
 	if quitting then return "quitting"; end
 	if once then quitting = "once"; end
-	_currenttime = luasocket_gettime( )
+	_currenttime = time_now();
 	repeat
 		-- Fire timers
 	local next_timer_time = math_huge;
@@ -1003,7 +1003,7 @@
 			handler:force_close()	 -- forced disconnect
 			_closelist[ handler ] = nil;
 		end
-		_currenttime = luasocket_gettime( )
+		_currenttime = time_now();
 
 		-- Check for socket timeouts
 		if _currenttime - _starttime > _checkinterval then
@@ -1151,7 +1151,7 @@
 use "setmetatable" ( _readtimes, { __mode = "k" } )
 use "setmetatable" ( _writetimes, { __mode = "k" } )
 
-_starttime = luasocket_gettime( )
+_starttime = time_now();
 
 local function setlogger(new_logger)
 	local old_logger = log;