Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.047 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'random': 0.14; 'bit.': 0.16; 'funcs': 0.16; 'interval,': 0.16; 'time.time()': 0.16; 'utc,': 0.16; 'wrote:': 0.18; 'email addr:gmail.com>': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'script': 0.25; 'defined': 0.27; 'idea': 0.28; 'chris': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'though.': 0.31; 'running': 0.33; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'seconds': 0.37; 'so,': 0.37; 'skip:& 20': 0.39; "you're": 0.61; 'subject:there': 0.68; '9am': 0.84; 'mean.': 0.91; 'to:none': 0.92; 'directly.': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:from:date:message-id:subject:cc :content-type; bh=kkT/WmAA8CqPh0NR3/wh37RuCfT74M96MRGg7MMyq/0=; b=c2vkyyQn4QPTcbYpWVmD+VuWFaUZZS3sDEpiIvo2F93inL10zQ9cq/hbt4Mvv2GBy/ ERY410CuAqDD4C6c+KfEWnl4D8i++25VOw0KAcmd1x7RYjzWz0OUogKlNCDtwVRfeJOE ogpe8q2xvIw+415eGy+P597E35AH5NnoVbXx+hh5PAZmKIEzS76o3mAJL3S7Y7uwyQbT wBD+Vr7ctgIjY+ELsDTynECGm3OwPcXGso8l0xPHgkUmUwkm5ibR0sYoDxO7mJ25KAbu p5xiSbMa4aJHdcNmHEcj0Z83VGND1uSdNXszq0Y0lAX6SsHwdMsNm+8nKItqvM1HSka7 sz1A== X-Received: by 10.42.236.75 with SMTP id kj11mr14438355icb.47.1418852856807; Wed, 17 Dec 2014 13:47:36 -0800 (PST) MIME-Version: 1.0 References: From: Juan Christian Date: Wed, 17 Dec 2014 21:47:36 +0000 Subject: Re: Is there a way to schedule my script? Cc: "python-list@python.org" Content-Type: multipart/alternative; boundary=20cf3026698284c691050a706c96 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418852858 news.xs4all.nl 2912 [2001:888:2000:d::a6]:36177 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82617 --20cf3026698284c691050a706c96 Content-Type: text/plain; charset=UTF-8 On Wed Dec 17 2014 at 7:35:10 PM Chris Angelico 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. --20cf3026698284c691050a706c96 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Wed Dec 17 2014 at 7:35:10 PM Chris Angelico = <rosuav@gmail.com> wrote:
=
time.time() % 86400

That's number of seconds since midnigh= t UTC, ranging from 0 up to
86399. (I've no idea what 645633332 wou= ld mean. That's an awfully big
number for a single day.) If you off= set that before calculating, you
can get that in your local time. Other= wise, just do the arithmetic
directly. Time isn't all _that_ hard t= o 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, bu= t 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 &qu= ot;slowdown" a bit.
--20cf3026698284c691050a706c96--