elfresno wrote: Hi, I'm working on a script that triggers instructions based on predefined times in a file, so I think I'm going to have to compare these times with a timecode that I generate to keep me on time. The problem is that I don't know how to run a timecode, and how to make comparisons in the script.
Several suggestions. But no simple answer.elfresno wrote: ↑Mon Aug 26, 2019 3:21 pmI am using Raspbian Jessi Lite in rpi3. I was using time sleep between the instructions, and between triggering the instructions and looking for the values of the new times and values there is time that is not counted and throughout the script it will be accumulating, if you know a better way to do it, tell me Thank you
Code: Select all
import time
start = time.time()
while True:
if time.time() - start >= 1:
print ("1 second")
start = time.time()Code: Select all
$ python
Python 3.6.1 | packaged by rpi | (default, Apr 20 2017, 19:35:19)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.time()
1566926863.543218
>>>
Code: Select all
>>> time.time() - time.time()
-8.58306884765625e-06