Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82617

Re: Is there a way to schedule my script?

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 <juan0christian@gmail.com>
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&gt;': 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 <mailman.17010.1418843457.18130.python-list@python.org> <m6sm9d$5es$1@reader1.panix.com> <mailman.17012.1418845926.18130.python-list@python.org> <m6soo5$mc3$1@reader1.panix.com> <CAAp0bGubrVZAYgXp3yZfWty+2fJGR7-=qn0jkquV9DCGqx4VGg@mail.gmail.com> <CAPTjJmoGcUdJe11aGrTdzjqyQ9c7pnK=GqbkFxF23Ck+v_i4pw@mail.gmail.com>
From Juan Christian <juan0christian@gmail.com>
Date Wed, 17 Dec 2014 21:47:36 +0000
Subject Re: Is there a way to schedule my script?
Cc "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17019.1418852858.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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 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.

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-17 19:10 +0000
  Re: Is there a way to schedule my script? John Gordon <gordon@panix.com> - 2014-12-17 19:41 +0000
    Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-17 19:51 +0000
      Re: Is there a way to schedule my script? John Gordon <gordon@panix.com> - 2014-12-17 20:23 +0000
        Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-17 20:42 +0000
        Re: Is there a way to schedule my script? Chris Angelico <rosuav@gmail.com> - 2014-12-18 08:34 +1100
        Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-17 21:47 +0000
        Re: Is there a way to schedule my script? Michael Torrie <torriem@gmail.com> - 2014-12-18 09:45 -0700
  Re: Is there a way to schedule my script? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-18 10:39 +1100
    Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-18 01:04 +0000
    Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-18 12:37 +0000
    Re: Is there a way to schedule my script? Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-18 09:23 -0700
    Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-18 22:13 +0000
    Re: Is there a way to schedule my script? Chris Angelico <rosuav@gmail.com> - 2014-12-19 12:32 +1100
    Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-19 01:55 +0000
    Re: Is there a way to schedule my script? Terry Reedy <tjreedy@udel.edu> - 2014-12-19 00:58 -0500
  Re: Is there a way to schedule my script? Josh English <Joshua.R.English@gmail.com> - 2014-12-18 09:13 -0800
    Re: Is there a way to schedule my script? Juan Christian <juan0christian@gmail.com> - 2014-12-18 18:29 +0000

csiph-web