| Store | Cart

mysteriously nonfunctioning script - very simple

From: Diez B. Roggisch <deet...@web.de>
Sat, 26 Mar 2005 20:01:41 +0100
> ######################################################################> from time import sleep,time,localtime> > wakeuptime = (7,00)> ## I WANT TO BE WOKEN UP AT 7AM (FOR EXAMPLE)> > onehourlater = (wakeuptime[0]+1, wakeuptime[1])> ## ONE HOUR LATER THAN THAT IS 8AM> > while not wakeuptime < localtime(time())[3:5] < onehourlater: sleep(3)> ## CHECK THE CURRENT TIME EVERY 3 SECONDS, AND IF IT'S NOT BETWEEN> ## 7AM AND 8AM, GO BACK TO SLEEP FOR ANOTHER 3 SECONDS> 

It does work for me:

>>> wakeuptime = (19,00)>>> onehourlater = (20,00)>>> lt = (18,59)>>> not wakeuptime < lt < onehourlater
True

>>> lt = (19:01)>>> not wakeuptime < lt < onehourlater
False

And localtime(time())[3:5] returns the desired timetuple. You're sure that's
not working?

-- 
Regards,

Diez B. Roggisch

Recent Messages in this Thread
Sean McIlroy Mar 26, 2005 06:13 am
Piet van Oostrum Mar 26, 2005 11:12 am
Peter Hansen Mar 26, 2005 11:55 am
Sean McIlroy Mar 26, 2005 06:47 pm
Diez B. Roggisch Mar 26, 2005 07:01 pm
Peter Otten Mar 26, 2005 07:19 pm
Michael Spencer Mar 26, 2005 07:41 pm
Heiko Wundram Mar 26, 2005 08:52 pm
Sean McIlroy Mar 27, 2005 07:41 pm
Greg Ewing Mar 31, 2005 04:04 am
Messages in this thread