time.sleep is not exactly accurate, so I would suggest that you use this 
method, short 5 minutes or so and then do a sleep(10) or so in a loop to get 
closer to the time.


>>import time
>>b = '20:00:00'
>>
>>(bhour, bmin, bsec) = b.split(':')
>>bsec = int(bsec) + int(bmin)*60 + int(bhour)*360
>>
>>while True:
>>     act = time.localtime()
>>     actsec = act.tm_sec + act.tm_min*60 + act.tm_hour*360
>>     wait = bsec - actsec
>>     if wait < 0:
>>         wait += 360*24 # it will be tomorrow
>>     time.sleep(wait)
>>     print 'I am doing!'
>>     break
>
> Ah, very nice! (But all the '360's should be '3600', of course.)
>
> Thanks, Janos.
>
> Dick
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to