This commit is contained in:
lwl0608 2024-05-08 16:53:02 +08:00
parent df4b88f9c0
commit af9a09ca48
1 changed files with 9 additions and 6 deletions

View File

@ -22,7 +22,7 @@ class S:
rows = self.mysql_db_bi.query(sql)
if len(rows) > 0:
dt = rows[0].get("ptime")
return dt.timestamp()
return int(dt.timestamp())
return 0
def get_flow(self, st, et):
@ -33,13 +33,16 @@ class S:
return 0
def proc(self):
time_now = int(time.time())
zero_time = get_today_zero_time() - 86400
last_ptime = self.get_last_ptime()
if last_ptime == 0:
return
last_time = self.get_last_ptime()
print(zero_time)
print(last_ptime, type(last_ptime))
while last_time <= get_today_zero_time():
next_time = last_time + 300
flow = self.get_flow(zero_time, next_time)
print(get_time_str_by_ts(next_time), flow)
last_time += 300
time.sleep(0.5)
s = S()