3

So I am exploring automation in my program, and I need it to run code every time the next minute starts, an example:

Let's say it is 8:12:32, I would want it to run at 8:13:00 instead of 8:13:32

Because of this, sleep doesn't work for my purposes.

I was searching around Stack Overflow for an answer before I opened a question and I found something like this:

def minute_passed(oldepoch):
    return time.time() - oldepoch >= 60

However, it has to be manually called every time I want to check. I need it to continuously test.

Sorry, Python is kind of a new experience for me.

Currently using Python 3.6 and Windows

2 Answers2

1

From a comment by Codelt

You can use sched or check this answer

1

If you know time in seconds, then you can try

sleep(60 - seconds)
Tabin1000
  • 93
  • 1
  • 9