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


Groups > comp.lang.python > #29053

Re: datetime

References <loom.20120913T170328-631@post.gmane.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2012-09-13 11:08 -0600
Subject Re: datetime
Newsgroups comp.lang.python
Message-ID <mailman.620.1347556135.27098.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Sep 13, 2012 at 9:19 AM, Max <readmax@hushmail.com> 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?

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


Thread

Re: datetime Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-13 11:08 -0600

csiph-web