0
How to start a command at a given time insidea python code?
For examle every half an hour...
5 Réponses
+ 2
Use time module
+ 1
So make your code to calculate the time taken for every run (your process time) and subtract the time(time.sleep(your subtracted time) to make it exactly half an hour
0
Yes, i used it already.
Here's my code.(temp read software for rpi):
www.fierostudio.hu/10.pdf
Now it waits 1800 sec (time.sleep(1800)) after
every loop. Because process takes some secs every time, so there will be a little more time between the instructions are done.
So i would like to start the instructions inside the loop in every exact half an hour. Is there a simple function for that inside the time module?
I hope i was clear.
Thanks!
0
Wow! Thanks! That was the idea i needed!
0
Because of the troubleshooting process, one run's duration can't be predictible. But at the end of one run, i can get the exact time, and from it i can calculate the upcoming sleep time. So thanks for the idea.
Before, i was thinking of how to start a run at a given time... So the code allways would had to watch the time somehow...