代码拉取完成,页面将自动刷新
import time
import datetime
import logging
import sys
import random
padding = 1 # 提前时间
interval = 1 # 区间
minute = 59
if len(sys.argv) >= 2:
padding = float(sys.argv[1])
if len(sys.argv) >= 3:
interval = float(sys.argv[2])
if len(sys.argv) >= 4:
minute = int(sys.argv[3])
if padding == 0 or interval == 0:
second_setting = 0
ms_setting = 0
else:
start_time = 60 - padding - 0.5*interval
second_setting = int(start_time)
ms_setting = int((start_time - second_setting)*10**6)
target_time = datetime.datetime.now()
if target_time.minute > minute:
target_time = target_time.replace(hour=target_time.hour+1,minute=minute, second=second_setting, microsecond=ms_setting)
else:
target_time = target_time.replace(minute=minute, second=second_setting, microsecond=ms_setting)
i=0
while datetime.datetime.now() < target_time:
i += 1
if i % 300 == 0:
logging.warn(f'{datetime.datetime.now()}未到{target_time}点')
time.sleep(0.01)
time.sleep(random.random()*interval)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。