import multiprocessing
import time
def clock(interval):
while True:
print ("the time is %s" % time.ctime())
time.sleep(interval)
class ClockProcess(multiprocessing.Process):
def __init__(self,interval):
multiprocessing.Process.__init__(self)
self.interval = interval
def run(self):
while True:
print (" current time is %s" % time.ctime())
time.sleep(self.interval)
#p = multiprocessing.Process(target=clock,args=(15,))
p = ClockProcess(5)
p.start();
import time
def clock(interval):
while True:
print ("the time is %s" % time.ctime())
time.sleep(interval)
class ClockProcess(multiprocessing.Process):
def __init__(self,interval):
multiprocessing.Process.__init__(self)
self.interval = interval
def run(self):
while True:
print (" current time is %s" % time.ctime())
time.sleep(self.interval)
#p = multiprocessing.Process(target=clock,args=(15,))
p = ClockProcess(5)
p.start();