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