I am running a server that uses mod orienteering.
After some time of playing, another player say me, that he sees run rise in the bad time and it is happening for a long time period (weeks).
I have done some checks, and it looks like he sees a different time than I see, and he sees a different time than command /time shows him.
i check code of command /time and of orienteering to identify the problem.
orienteering code showing the time:
Code: Select all
local time = minetest.get_timeofday()
if watch or gps or quadcorder then
local totalminutes = time * 1440
local minutes = totalminutes % 60
local hours = math.floor((totalminutes - minutes) / 60)
minutes = math.floor(minutes)
local twelve = player:get_meta():get_string("orienteering:twelve") == "true"
if twelve then
if hours == 12 and minutes == 0 then
str_time = S("Time: noon")
elseif hours == 0 and minutes == 0 then
str_time = S("Time: midnight")
else
local hours12 = math.fmod(hours, 12)
if hours12 == 0 then hours12 = 12 end
if hours >= 12 then
str_time = S("Time: @1:@2 p.m.", string.format("%i", hours12), string.format("%02i", minutes))
else
str_time = S("Time: @1:@2 a.m.", string.format("%i", hours12), string.format("%02i", minutes))
end
end
else
str_time = S("Time: @1:@2", string.format("%02i", hours), string.format("%02i", minutes))
end
else
str_time = ""
end
Code: Select all
core.register_chatcommand("time", {
params = "[<0..23>:<0..59> | <0..24000>]",
description = "Show or set time of day",
privs = {},
func = function(name, param)
if param == "" then
local current_time = math.floor(core.get_timeofday() * 1440)
local minutes = current_time % 60
local hour = (current_time - minutes) / 60
return true, ("Current time is %d:%02d"):format(hour, minutes)
end
local player_privs = core.get_player_privs(name)
if not player_privs.settime then
return false, "You don't have permission to run this command " ..
"(missing privilege: settime)."
end
local hour, minute = param:match("^(%d+):(%d+)$")
if not hour then
local new_time = tonumber(param)
if not new_time then
return false, "Invalid time."
end
-- Backward compatibility.
core.set_timeofday((new_time % 24000) / 24000)
core.log("action", name .. " sets time to " .. new_time)
return true, "Time of day changed."
end
hour = tonumber(hour)
minute = tonumber(minute)
if hour < 0 or hour > 23 then
return false, "Invalid hour (must be between 0 and 23 inclusive)."
elseif minute < 0 or minute > 59 then
return false, "Invalid minute (must be between 0 and 59 inclusive)."
end
core.set_timeofday((hour * 60 + minute) / 1440)
core.log("action", ("%s sets time to %d:%02d"):format(name, hour, minute))
return true, "Time of day changed."
end,
})
I do an experiment with the player: He calls /time command at 16:00 and 17:00 clock shows by orienteering.
orienteering time: 16:00 command /time : 16:11
orienteering time: 17:00 command /time : 17:49
The player says to me, that he sees time is not changing continuously, but jerkily.
I know that there are some UDP packets lost in the connection between the affected player and server.
So it looks to me, like the part of the orienteering code is processed on the client-side, and UDP packets lost causes client time synchronization lost (so, showed client time is slower than server time).
Both server and affected client using Linux Minetest version 5.3.0
Server using default value of parameter "time_send_interval".