File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919import asyncio
2020import logging
2121import os
22+ import time
2223from datetime import datetime , timedelta
2324from hashlib import sha1
2425from io import BytesIO
@@ -303,17 +304,15 @@ async def next_salt_worker(self):
303304 log .info ("NextSaltTask started" )
304305
305306 while True :
306- now = datetime .now ( )
307+ now = datetime .fromtimestamp ( time . perf_counter () - MsgId . reference_clock + MsgId . server_time )
307308
308309 # Seconds to wait until middle-overlap, which is
309310 # 15 minutes before/after the current/next salt end/start time
310311 valid_until = datetime .fromtimestamp (self .current_salt .valid_until )
311312 dt = (valid_until - now ).total_seconds () - 900
312313
313- log .info ("Next salt in {:.0f}m {:.0f}s ({})" .format (
314- dt // 60 , dt % 60 ,
315- now + timedelta (seconds = dt )
316- ))
314+ minutes , seconds = divmod (int (dt ), 60 )
315+ log .info (f"Next salt in { minutes :.0f} m { seconds :.0f} s (at { now + timedelta (seconds = dt )} )" )
317316
318317 try :
319318 await asyncio .wait_for (self .next_salt_task_event .wait (), dt )
You can’t perform that action at this time.
0 commit comments