#! usr/bin/python import threading import time def jpSelfCalling(args): now = time.asctime() nowTuple = time.strptime(now) if nowTuple[3] <= 8 or nowTuple[3] >= 18: newArgs = [60] else: newArgs = [10] print nowTuple t = threading.Timer(args, jpSelfCalling, newArgs) t.start() if __name__ == '__main__': import sys jpSelfCalling(10)