예제 #1
0
    def add_reminder(self, id):
        logger.debug("scheduler: add_reminder")
        database = db.Database(self.db_file)
        a = database.alarm(id)
        database.close()

        d = str_to_date(a.time, a.date)
        logger.debug("scheduler: add_reminder, datetime: " + str(d.strftime(internal_date_format + " " + internal_time_format)) + " (" + a.date + " " + a.time + ")")
        delay = timestamp(d) - timestamp(datetime.now())

        if delay > 0:
            self.add_to_schedule(delay, id)
            logger.debug("timer for " + str(delay) + "s from now: " + a.label)
예제 #2
0
    "every weekday from monday to next monday",
    "every weekend",
    "every weekend from sun",
    "every weekend from Oct 8, 2012 to October 8, 2013",
    "every other",
    "every other from 5",
    "every other from 5 to 10",
    "next 30 days",
    "next 30 days from yesterday",
    ]

counter = 0
for row in singular:
    value = d.str_date_simplify(row, 0)
    print str(value) + " (" + row + ")"
    dt = d.str_to_date(None, value)
    print dt

    if dt != valid_singular[counter]:
        print "should be " + str(valid_singular[counter])
        exit()

    counter += 1

counter = 0
for row in repeating:
    value = d.str_date_simplify(row, 0)
    print str(value) + " (" + row + ")"
    dt = d.str_to_date(None, value)
    print dt