From 5e3f2ab94795bacbad6b56febb1a6b16938f355c Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 29 Aug 2020 16:58:49 +0200 Subject: [PATCH] Replace monotonic() with perf_counter() It seems like monotonic() goes out of sync after some time. --- pyrogram/session/internals/msg_id.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/session/internals/msg_id.py b/pyrogram/session/internals/msg_id.py index 72b8e81f..95155d3c 100644 --- a/pyrogram/session/internals/msg_id.py +++ b/pyrogram/session/internals/msg_id.py @@ -18,19 +18,19 @@ import logging from datetime import datetime -from time import monotonic +from time import perf_counter log = logging.getLogger(__name__) class MsgId: - reference_clock = monotonic() + reference_clock = perf_counter() last_time = 0 msg_id_offset = 0 server_time = 0 def __new__(cls) -> int: - now = monotonic() - cls.reference_clock + cls.server_time + now = perf_counter() - cls.reference_clock + cls.server_time cls.msg_id_offset = cls.msg_id_offset + 4 if now == cls.last_time else 0 msg_id = int(now * 2 ** 32) + cls.msg_id_offset cls.last_time = now