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: 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: References: Date: Thu, 18 Dec 2014 08:34:33 +1100 Subject: Re: Is there a way to schedule my script? From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Thu, Dec 18, 2014 at 7:42 AM, Juan Christian 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