Home > other > According to the computer clock, in five minutes each hour. 10 minutes. 15 minutes,... 45 minutes an
According to the computer clock, in five minutes each hour. 10 minutes. 15 minutes,... 45 minutes an
Time:11-30
Based on computer clock, at each hour of 5 minutes, 10 minutes, 15 minutes,,,,,,, 45 minutes and 50 minutes, 55, minutes, 00 minute began to run the program,
import datetime Instant=1 # this variable is used to ensure that print only once in a interval While True: Now=datetime. Datetime. Now () If now. The 5 minute %==0 and now the minute!=instant: Instant=now. Minute Print (" Hello, world ")
CodePudding user response:
CPU usage is too high
CodePudding user response:
The from threading import Timer
A timer, a minute time
Perfect, and then open two timers, the first is to calculate the next time (0,5,10) time difference, to start a second timer, the second is the work, set to 5 minutes (300 seconds),