Skip to content
Snippets Groups Projects
Commit 4fdbf579 authored by 42loop's avatar 42loop
Browse files

first (late) commit

parent 8cfdc545
Branches
No related tags found
No related merge requests found
...@@ -44,11 +44,30 @@ def db_dump(): ...@@ -44,11 +44,30 @@ def db_dump():
cur.execute("SELECT * FROM trains") cur.execute("SELECT * FROM trains")
rows = cur.fetchall() rows = cur.fetchall()
train_time=0
last_et_stamp=0
last_st_stamp=0
for row in rows: for row in rows:
#print(row[1]) #print(row[1])
st = datetime.datetime.fromtimestamp(float(row[1])-7200.0) #.strftime('%Y-%m-%d %H:%M:%S')) st_stamp=float(row[1])-7200.0
print(st,float(row[2])*1000000) if st_stamp>last_et_stamp+45:
st = datetime.datetime.fromtimestamp(last_st_stamp) #.strftime('%Y-%m-%d %H:%M:%S'))
et = datetime.datetime.fromtimestamp(last_et_stamp)
if train_time>2:
#print(st," to ", et," train_time: ",train_time)
print(str(last_st_stamp)+",%.2f" % train_time)
#print("----------------new train")
last_st_stamp=st_stamp
train_time=0
train_time+=float(row[2])
et_stamp=float(row[1])-7200.0+float(row[2])
st = datetime.datetime.fromtimestamp(st_stamp) #.strftime('%Y-%m-%d %H:%M:%S'))
et = datetime.datetime.fromtimestamp(et_stamp)
#print(st,float(row[2]),et)
last_et_stamp=et_stamp
def db_create(): def db_create():
global con global con
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment