Esempio n. 1
0
        print("%s called in %s" % (arg, current_time))
        return True

    def handle_close(self, arg, flag):
        print("%s closed" % arg)

if __name__ == '__main__':

    g_reactor = Reactor()
    if not g_reactor.open():
        print("reactor open failed")

    # crontab
    entry = "2-10 2-10 23-7/2 * mon-/2"
    print("%s" % entry)
    print("%s timerid = %d" % ('=' * 30, g_reactor.crontab(Crontab(), entry, entry)))

    entry = "45-10/2 * 23-7/2 * mon-/2"
    print("%s" % entry)
    print("%s timerid = %d" % ('=' * 30, g_reactor.crontab(Crontab(), entry, entry)))

    entry = "12/2 */2 23-30/2 4-10/2,11/2,12- 2,4,7"
    print("%s" % entry)
    print("%s timerid = %d" % ('=' * 30, g_reactor.crontab(Crontab(), entry, entry)))

    entry = "30-10/2 * * * *"
    print("%s" % entry)
    print("%s timerid = %d" % ('=' * 30, g_reactor.crontab(Crontab(), entry, entry)))

    entry = "*/2 */2 * * *"
    print("%s" % entry)