Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'value,': 0.03; 'anyway.': 0.04; 'python': 0.09; 'naturally': 0.09; 'sep': 0.09; 'language': 0.14; 'library': 0.15; 'value.': 0.15; 'anyway).': 0.16; 'low- level': 0.16; 'seconds,': 0.16; 'sync': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'systems.': 0.18; 'python?': 0.20; 'clock': 0.22; 'libraries': 0.22; 'second': 0.24; 'machine': 0.24; 'header:In- Reply-To:1': 0.25; '(which': 0.26; 'setting': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'probably': 0.29; "i'm": 0.29; 'running': 0.32; 'shift': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'needed': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'method': 0.36; 'should': 0.36; 'itself': 0.37; 'level': 0.37; 'virtual': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'lost': 0.60; 'matter': 0.61; 'making': 0.64; 'hoping': 0.72; '9:19': 0.84; 'milliseconds': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=UdNqMOMQ3Y7gSJr4kbQkgi4JreDyri7sdaFk3/qWyBo=; b=PjmMwR36WGkAEoK4voY4QSZGI2fEJPwoLx53ckq2xV6Npq6esJpedFiV9UzBmahWLi 6AGwxq9hicn3/CO+SH6pyad1ikorBWyLiJCSV+iR8XmGUBe/VoAibPVdzDR4YJnATkgd LerXkosimEZ/Cm84yV9odUVh/E4tiHjuOU2Iy5gqoW6nM0puQFsxDVsSPVcUgU0Gl9CZ LNi0GioWmISBbtaV5yuYggJnZC3NdRmgL5vdnjamOm22/1up4n+908S6CFmpgLgshMR1 2zwZTM1yLHY477aBxYrlERlHVRtU05HqhekBrkCcJJnhG/y1QHTzndbYH7bDPLjlXqRc pO3A== MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Thu, 13 Sep 2012 11:08:23 -0600 Subject: Re: datetime To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347556135 news.xs4all.nl 6976 [2001:888:2000:d::a6]:39108 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29053 On Thu, Sep 13, 2012 at 9:19 AM, Max wrote: > How do I set the time in Python? On what platform? I don't know of any libraries for this, so it would be a matter of making the necessary system calls (which is all that a library would do anyway). > Also, is there any *direct* way to shift it? Only by changing the timezone setting. Any method of offsetting the system clock itself is going to involve at some level reading the current value, adding or subtracting, and then setting the new value. > Note that any "indirect" methods may need complicated ways to keep > track of the milliseconds lost while running them. It even took around one > second in some virtual machine guest systems. So I'm hoping Python happens to > have the magic needed to do the job for me. If you're concerned about individual seconds, then you probably should do this in a low-level language like C. Also, the clock is going to drift naturally over time anyway. How are you going to keep it in sync if not with ntp?