This commit is contained in:
ClF3 2024-01-24 01:09:25 +08:00
parent 2d11336736
commit 2a80c87d22
1 changed files with 21 additions and 18 deletions

39
main.py
View File

@ -3,11 +3,14 @@ import numpy as np
import urllib.request
from datetime import datetime
import time
recent=[]
recent_blog=[]
recent_cloud=[]
recent_code=[]
recent_git=[]
blog=[]
git=[]
cloud=[]
code=[]
git=[]
width=720
height=50
red=(0x00,0x00,0xff)
@ -69,13 +72,13 @@ if __name__=="__main__":
print("connected",delay,"ms")
else:
print("error")
if len(recent)<10:
recent.append(delay)
if len(recent_blog)<10:
recent_blog.append(delay)
else:
update_history(blog)
update_graph("blog.png",blog)
recent=[]
recent.append(delay)
recent_blog=[]
recent_blog.append(delay)
elif datetime.now().second==10 and datetime.now().minute!=lastminute:
# if True:
@ -86,13 +89,13 @@ if __name__=="__main__":
print("connected",delay,"ms")
else:
print("error")
if len(recent)<10:
recent.append(delay)
if len(recent_cloud)<10:
recent_cloud.append(delay)
else:
update_history(cloud)
update_graph("cloud.png",cloud)
recent=[]
recent.append(delay)
recent_cloud=[]
recent_cloud.append(delay)
elif datetime.now().second==20 and datetime.now().minute!=lastminute:
# if True:
@ -103,13 +106,13 @@ if __name__=="__main__":
print("connected",delay,"ms")
else:
print("error")
if len(recent)<10:
recent.append(delay)
if len(recent_code)<10:
recent_code.append(delay)
else:
update_history(code)
update_graph("code.png",code)
recent=[]
recent.append(delay)
recent_code=[]
recent_code.append(delay)
elif datetime.now().second==30 and datetime.now().minute!=lastminute:
# if True:
@ -120,10 +123,10 @@ if __name__=="__main__":
print("connected",delay,"ms")
else:
print("error")
if len(recent)<10:
recent.append(delay)
if len(recent_git)<10:
recent_git.append(delay)
else:
update_history(git)
update_graph("git.png",git)
recent=[]
recent.append(delay)
recent_git=[]
recent_git.append(delay)