diff --git a/src/handler.py b/src/handler.py index 8bb7a7c..dd9a580 100644 --- a/src/handler.py +++ b/src/handler.py @@ -48,9 +48,7 @@ def unhandled(cli, prefix, cmd, *args): def ping_server(cli): if var.SERVER_PING_INTERVAL > 0: - ts = time.time() - var.LAST_SERVER_PING = ts - cli.send("PING :{0}".format(ts)) + cli.send("PING :{0}".format(time.time())) threading.Timer(var.SERVER_PING_INTERVAL, ping_server, args=(cli,)).start() def connect_callback(cli): diff --git a/src/settings.py b/src/settings.py index 8dc692b..6bc2be2 100644 --- a/src/settings.py +++ b/src/settings.py @@ -206,7 +206,6 @@ PASTEBIN_ERRORS = False # How often to ping the server (in seconds) to detect unclean disconnection SERVER_PING_INTERVAL = 120 -LAST_SERVER_PING = None # TODO: move this to a game mode called "fixed" once we implement a way to randomize roles (and have that game mode be called "random") DEFAULT_ROLE = "villager" diff --git a/src/wolfgame.py b/src/wolfgame.py index 10542ca..28c56a6 100644 --- a/src/wolfgame.py +++ b/src/wolfgame.py @@ -498,7 +498,7 @@ def latency(cli, nick, chan, rest): @hook("pong", hookid=300) def latency_pong(cli, server, target, ts): - lat = round(time.time() - var.LAST_SERVER_PING, 3) + lat = round(time.time() - float(ts), 3) reply(cli, nick, chan, messages["latency"].format(lat, "" if lat == 1 else "s")) hook.unhook(300)