raspberry pi - Run a python code every 00 seconds on the clock (python) -
how run code when clock turns 00 seconds in python? (12:31:00, 13:24:00,.. hh:mm:00) using rpi, when 00 seconds strikes, code print something, else wait.
my idea code is.. formatting wrong. thank you!
while true: if datetime == hh:mm:00 print format(datetime.datetime.now()) else wait
time till end of current minute can computed:
while true: = datetime.datetime.now() time.sleep(60.0 - now.second - now.microsecond / 1e6) # work
Comments
Post a Comment