The time starts from '000000' to '235959'.
while True:
if time > '000500': # 00:05:00
if condition_0:
break
elif time > '000400':
if condition_1:
break
elif time > '000300':
if condition_2:
break
elif time > '000200':
if condition_3:
break
else:
if condition_4:
break
This code checks time first and then check condition if the time is fine.
while True:
if time > '000500' and condition_0:
break
elif time > '000400' and condition_1:
break
elif time > '000300' and condition_2:
break
elif time > '000200' and condition_3:
break
elif condition_4:
break
And then I put the time and condition in one line. Does this check time and condition at the same time (check time and then condition) or checks time first and then condition if time is OK?
I would like to use the second one. But if it checks both time and condition at the same time even though the time is not satisfied, then this one sucks because my code gets data(time and condition) constantly fast.
Aucun commentaire:
Enregistrer un commentaire