If you're not using a real-time operating system, then no language can guarantee it'll be running at a specific time. Normally (99% of the time), being "close enough" is fine. But those times you really do need extremely specific timing without any delays, it's incredibly important, like for pacemakers (offset a heart beat a bit, and you might be killing someone).
So first, you should define how important it actually is to be that accurate. If it truly is that important, you probably shouldn't be using python at all.
But if it isn't critical, time.sleep() is fine:
So first, you should define how important it actually is to be that accurate. If it truly is that important, you probably shouldn't be using python at all.
But if it isn't critical, time.sleep() is fine:
import time # 1 min = 60 sec # 1 sec = 1e9 ns delay_for = 60 * 1e9 print("Starting...") delay_until = time.time_ns() + delay_for while delay_until > time.time_ns(): time.sleep((delay_until - time.time_ns()) / 1e9) print("1 minute(ish) has passed")