def makeThread(): """ 启动多线程计算 :return: """ day, hour, minute = getTime() if minute % 2 != 0: minute -= 1 t1 = MyThread.CalNumber(day, hour, minute) t1.start() t2 = MyThread.CalRank(day, hour, minute) t2.start() t3 = MyThread.CalThermodynamic(day, hour, minute) t3.start() t4 = MyThread.CalGuiding(day, hour, minute) t4.start() t5 = MyThread.CalAverage(day, hour, minute) t5.start() t6 = MyThread.CalBuy(day, hour, minute) t6.start() t7 = MyThread.CalPi(day, hour, minute) t7.start()
import time def getTime(): day = int(datetime.datetime.now().strftime("%d")) hour = int(datetime.datetime.now().strftime("%H")) minute = int(datetime.datetime.now().strftime("%M")) return day, hour, minute if __name__ == '__main__': day, hour, minute = getTime() day = 26 t1 = MyThread.CalNumber(day, hour, minute) t1.start() t2 = MyThread.CalRank(day, hour, minute) t2.start() t3 = MyThread.CalThermodynamic(day, hour, minute) t3.start() t4 = MyThread.CalGuiding(day, hour, minute, "顺风大酒店") t4.start() time.sleep(60) db = Reserve() day, hour, minute = getTime() day = 26 while True: print("实时:{}号{}时{}分".format(day, hour, minute)) print("当前实时人流:{}".format(db.getNumOfPeople(day, hour, minute)))