2 Star 4 Fork 4

miaomi8/jd28

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
accwait.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
hajiuhajiu 提交于 2021-03-03 11:07 . Add files via upload
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gald/jd28.git
git@gitee.com:gald/jd28.git
gald
jd28
jd28
master

搜索帮助