diff net/server_event.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 dae094b392d1
children 91afc1f07337
line wrap: on
line diff
--- a/net/server_event.lua	Fri Feb 13 16:19:12 2026 +0100
+++ b/net/server_event.lua	Fri Jan 30 14:08:53 2026 +0100
@@ -54,8 +54,7 @@
 local inet_pton = inet.pton;
 local sslconfig = require "prosody.util.sslconfig";
 local tls_impl = require "prosody.net.tls_luasec";
-
-local socket_gettime = socket.gettime
+local time_now = require "prosody.util.time".now;
 
 local log = require ("prosody.util.logger").init("socket")
 
@@ -521,7 +520,7 @@
 	local interface = {
 		type = "client";
 		conn = client;
-		currenttime = socket_gettime( );  -- safe the origin
+		currenttime = time_now();  -- safe the origin
 		writebuffer = {};  -- writebuffer
 		writebufferlen = 0;  -- length of writebuffer
 		send = client.send;  -- caching table lookups
@@ -918,7 +917,7 @@
 local function add_task(delay, callback)
 	local event_handle;
 	event_handle = base:addevent(nil, 0, function ()
-		local ret = callback(socket_gettime());
+		local ret = callback(time_now());
 		if ret then
 			return 0, ret;
 		elseif event_handle then