1

I am working to print out a message to the terminal once every minute. I cannot use time.sleep() because there are other things that need to continue to run. Here is the what I have so far, but I am sure that there is a more legitimate what of doing this

startTime = time.time()
.
..
...
code to run other things
...
..
.     
endTime= time.time()
epochTime = int(endTime - startTime)

print ('epochTime: ' + str(epochTime))


if (epochTime % 60):
    print ('A minute has passed')

Please advice on my best course of acton here

Kamil
  • 1,256
  • 10
  • 17
Veejay
  • 515
  • 3
  • 7
  • 20
  • do you need this while your program is running or just every minute in general? – aydow Aug 21 '18 at 05:38
  • I need it every minute while my program is running – Veejay Aug 21 '18 at 05:39
  • @metatoaster thankyou, but I cannot have my program sleep for a full second, which is why i reckoned it is not a duplicate of the linked question. Please advice if Im mistaken here – Veejay Aug 21 '18 at 05:45
  • @Veejay there is a solution in my original linked answer that provide a non-blocking method, which the second duplicate question also referenced. – metatoaster Aug 21 '18 at 05:54

0 Answers0