Is there a way to schedule my script?

Juan Christian juan0christian at gmail.com
Wed Dec 17 16:47:36 EST 2014


On Wed Dec 17 2014 at 7:35:10 PM Chris Angelico <rosuav at gmail.com> wrote:

time.time() % 86400

That's number of seconds since midnight UTC, ranging from 0 up to
86399. (I've no idea what 645633332 would mean. That's an awfully big
number for a single day.) If you offset that before calculating, you
can get that in your local time. Otherwise, just do the arithmetic
directly. Time isn't all _that_ hard to work with.

I don't see what's the big problem with just using sleep() though.
Isn't that exactly what you're after?

This was a random number I invented.... So, I'm already using sleep to make
my script execute some funcs in a defined interval, but when the time is
0AM-9AM I don't want the delay to be the normal one (randint(5,10) * 60) -
5~10min, I want it to be like 2hours.

The script will be running 24/7, but from 0AM to 9AM it will "slowdown" a
bit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141217/80a45c1e/attachment.html>


More information about the Python-list mailing list