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


Groups > comp.lang.python > #82616

Re: Is there a way to schedule my script?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.056
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'time.time()': 0.16; 'utc,': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'otherwise,': 0.22; 'reset': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'clock': 0.31; 'though.': 0.31; 'problem': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:?': 0.36; 'seconds': 0.37; 'christian': 0.38; "you're": 0.61; 'kind': 0.63; 'subject:there': 0.68; 'counts': 0.83; '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:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=S+WszLkO/sCCFjByntdJ8n53oiD2Y+WWvjrzG6W8FvI=; b=wqgHxVXG3oWy6ZSWwtkdSFawHP3RVERpKVja5HFe1B+CVFdNZ12aAuE6b0jiK1fxwa OdFisfs6NqR2Fg+yGyYY/C72KeF9xf9QsX2l6zunRn9Ll8eQAQsNyekho40AjX88K9hp YgufO0FWBxQJNHphet5KAPV/1j2hcWC7xcGNvYweCFoPMLFJL4Wa0/HiK1NSTSLHagSs FHt4aIaGIjFdRYjWxyO3J51p5Os/x+mrzdGinWGxTl4iFDUg7Oekj3xtDuEY2TfxgdgZ uMarrfr/cWdeXv8lEcwA4qcDVmnmJk9X+tfTeHtnQl7odKHHSd9PSZWuyqRkTCF1CIGs FMpg==
MIME-Version 1.0
X-Received by 10.50.171.168 with SMTP id av8mr10513171igc.2.1418852073565; Wed, 17 Dec 2014 13:34:33 -0800 (PST)
In-Reply-To <CAAp0bGubrVZAYgXp3yZfWty+2fJGR7-=qn0jkquV9DCGqx4VGg@mail.gmail.com>
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>
Date Thu, 18 Dec 2014 08:34:33 +1100
Subject Re: Is there a way to schedule my script?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.17018.1418852082.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418852082 news.xs4all.nl 2859 [2001:888:2000:d::a6]:33329
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82616

Show key headers only | View raw


On Thu, Dec 18, 2014 at 7:42 AM, Juan Christian
<juan0christian@gmail.com> wrote:
> Is there any kind of time calculation in Python that counts the time like 0,
> 1, 2, 3... so that 0AM would be 0, and 11:59PM would be let's say
> '645633332'? And everyday it gets a reset when the clock 'turns'?

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?

ChrisA

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