From 15bdb3de4fdafc39ed88b4bad7732c1d7af8e40b Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 29 Aug 2020 17:28:39 +0200 Subject: [PATCH] Attempt to fix clock issues when running on AWS Lambda --- pyrogram/session/internals/msg_id.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyrogram/session/internals/msg_id.py b/pyrogram/session/internals/msg_id.py index 95155d3c..384a3e50 100644 --- a/pyrogram/session/internals/msg_id.py +++ b/pyrogram/session/internals/msg_id.py @@ -24,7 +24,7 @@ log = logging.getLogger(__name__) class MsgId: - reference_clock = perf_counter() + reference_clock = 0 last_time = 0 msg_id_offset = 0 server_time = 0 @@ -40,5 +40,6 @@ class MsgId: @classmethod def set_server_time(cls, server_time: int): if not cls.server_time: + cls.reference_clock = perf_counter() cls.server_time = server_time log.info(f"Time synced: {datetime.utcfromtimestamp(server_time)} UTC")