What I want to do in a python script is sleep a number of seconds until the required time is reached. IE: if runAt setting is 15:20 and current time is 10:20, how can I wor
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.