delay a task until certain time

Think you can also use the following code:

from datetime import datetime, time
from time import sleep

def act(x):
    return x+10

def wait_start(runTime, action):
    startTime = time(*(map(int, runTime.split(':'))))
    while startTime > datetime.today().time(): # you can add here any additional variable to break loop if necessary
        sleep(1)# you can change 1 sec interval to any other
    return action

wait_start('15:20', lambda: act(100))

If you subtract one datetime object from another you get a timedelta object, which has a seconds property, so you can do:

t1 = datetime.datetime.now()

# other stuff here
t2 = datetime.datetime.now()
delta = t2 - t1
if delta.seconds > WAIT:
    # do stuff
else:
    # sleep for a bit

As an aside, you might want to use cron for tasks that are supposed to run at specific times.