Note: read my comments on the provided answer, it doesn't work
I have a python program which runs every 5 seconds like this:
def main():
start_time = time.time()
while True:
if not execute_data():
break
time.sleep(5.0 - ((time.time() - start_time) % 5.0))
The question is how can I make it run from 7:00
to 23:00
only? I don't want to use my computer resources at times where I'm sure my program won't be helpful...