Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82006
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.064 |
| X-Spam-Evidence | '*H*': 0.87; '*S*': 0.00; 'anyway.': 0.05; 'subject:skip:t 10': 0.09; 'def': 0.12; "wouldn't": 0.14; 'windows': 0.15; 'paused': 0.16; 'semantics': 0.16; 'time.time()': 0.16; 'wrote:': 0.18; 'mechanism': 0.19; 'normally': 0.19; 'thu,': 0.19; 'seems': 0.21; 'machine': 0.22; '>>>': 0.22; 'import': 0.22; 'putting': 0.22; '>>>': 0.24; 'script': 0.25; '>': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'appear': 0.29; 'dec': 0.30; 'relative': 0.30; 'see,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'concern': 0.31; 'exclude': 0.31; 'linux.': 0.31; 'produces': 0.31; 'this.': 0.32; 'call.': 0.33; 'cases': 0.33; 'period': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'similar': 0.36; 'seconds': 0.37; 'so,': 0.37; 'clear': 0.37; 'skip:& 10': 0.38; 'stopped': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'duration': 0.60; 'ian': 0.60; 'numbers': 0.61; 'simply': 0.61; 'story': 0.63; 'skip:6 10': 0.63; 'different': 0.65; 'increasing': 0.74; 'macbook': 0.84; 'subject:over': 0.84; 'suspended,': 0.84; 'shocked': 0.91; 'suspension.': 0.91; 'reducing': 0.93 |
| 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=/3kPbgpGlGzsaHD18uYhVp3mIczKNZ462eHDb1Rz/DI=; b=hZumBsKDgdV+aFLnVs0bRi0Ew2r3PKcDT7FmT5jhpzMrBp7JJH8UwinPIbpTLhVY6B LwtDLa+Kw+spuASNLn4n9ELL/dPZeJ+JCAloziYY7bnEdNmG1C6y3EtTOLkGinc1TkA7 M6ef322i/hQhs9Tuzp63MWoecxQ1l8WgOqQo8ep4GBDo8vsnGpmV3Ta/Y4RWB0zB2lEe Lkx7gDNgYent21lUMsU3vPpbjqf7vc/ZLA6EP4wXFkzN7/5UyzMzFnEI4zhKhi0LxmnX ykNkOI4Hxav5fA5o5+VzPR3H3i0KGw6tBIFeSwnD62YVCxsXomJEUqots5I+KziePPp6 wkYw== |
| X-Received | by 10.66.245.167 with SMTP id xp7mr29280600pac.134.1417799134559; Fri, 05 Dec 2014 09:05:34 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <87r3wfnih0.fsf@elektro.pacujo.net> |
| References | <54807cfd$0$2311$426a74cc@news.free.fr> <87vblr8lcw.fsf@elektro.pacujo.net> <mailman.16564.1417709156.18130.python-list@python.org> <87r3wf8jy8.fsf@elektro.pacujo.net> <mailman.16566.1417710430.18130.python-list@python.org> <87ppbzp9qq.fsf@elektro.pacujo.net> <CALwzidn=g4+Rm0SJtSoXyA_5-QtgPBCNYOQ-kY9FYNaX__dJmw@mail.gmail.com> <87wq6788op.fsf@gmail.com> <mailman.16591.1417731511.18130.python-list@python.org> <87r3wfnih0.fsf@elektro.pacujo.net> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Fri, 5 Dec 2014 10:04:54 -0700 |
| Subject | Re: time.monotonic() roll over |
| To | Python <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=047d7b1117c9c7475405097b1589 |
| 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.16628.1417799143.18130.python-list@python.org> (permalink) |
| Lines | 94 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417799143 news.xs4all.nl 2839 [2001:888:2000:d::a6]:42179 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:82006 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Thu, Dec 4, 2014 at 3:44 PM, Marko Rauhamaa <marko@pacujo.net> wrote: > > Ian Kelly <ian.g.kelly@gmail.com>: > > > It's not clear to me whether those cases are relevant to the rollover > > concern anyway. I wouldn't be shocked if the GetTickCount() function > > simply stopped increasing while the system is suspended, since after > > all it's not "ticking" during that time. > > So, what's the semantics of time.sleep(), select.select() et al wrt > process or machine suspension? Rather than continue to speculate, I just tested this. I ran the following script in a Windows 7 VM and paused the VM for part of the duration of the sleep call. I unpaused well before the sleep call would normally have ended. >>> import time >>> def test(): ... t1 = time.time() ... m1 = time.monotonic() ... time.sleep(60) ... t2 = time.time() ... m2 = time.monotonic() ... return t2 - t1, m2 - m1 ... >>> test() (84.92642459869386, 60.002399999999994) As you can see, the sleep call and the monotonic time elapsed both appear to exclude the period when the VM was paused. Then I tried the same with a MacBook and putting the system to sleep instead of pausing a VM: >>> test() (59.889225006103516, 60.00102640298428) Reducing the sleep time to 10 seconds and suspending the process with Ctrl-Z produces a similar result on the MacBook: (10.000508069992065, 10.000266332994215) But the story is different in Linux. Here's what I got with the same Ctrl-Z test: (16.000478506088257, 16.000478034024127) I think the relative roundness of those numbers is just coincidence. I tried a second time and got: (12.613622903823853, 12.613622067990946) So it seems that it can go either way depending on the OS and perhaps the mechanism of suspension.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
time.monotonic() roll over "ast" <nomail@invalid.com> - 2014-12-04 16:25 +0100
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-04 17:50 +0200
Re: time.monotonic() roll over Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-04 09:05 -0700
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-04 18:21 +0200
Re: time.monotonic() roll over Chris Angelico <rosuav@gmail.com> - 2014-12-05 03:27 +1100
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-04 20:09 +0200
Re: time.monotonic() roll over Chris Angelico <rosuav@gmail.com> - 2014-12-05 05:29 +1100
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-04 20:44 +0200
Re: time.monotonic() roll over Chris Angelico <rosuav@gmail.com> - 2014-12-05 07:02 +1100
Re: time.monotonic() roll over Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-04 12:29 -0700
Re: time.monotonic() roll over Akira Li <4kir4.1i@gmail.com> - 2014-12-04 23:24 +0300
Re: time.monotonic() roll over Chris Angelico <rosuav@gmail.com> - 2014-12-05 07:33 +1100
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-04 22:51 +0200
Re: time.monotonic() roll over Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-04 15:17 -0700
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-05 00:44 +0200
Re: time.monotonic() roll over Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-05 10:04 -0700
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-05 20:48 +0200
Re: time.monotonic() roll over Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-05 11:39 +1100
Re: time.monotonic() roll over Dave Angel <davea@davea.name> - 2014-12-04 20:21 -0500
Re: time.monotonic() roll over Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-05 13:54 +1100
Re: time.monotonic() roll over Dave Angel <davea@davea.name> - 2014-12-05 00:29 -0500
Re: time.monotonic() roll over Lele Gaifax <lele@metapensiero.it> - 2014-12-05 08:56 +0100
Re: time.monotonic() roll over Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-05 21:09 +1100
Re: time.monotonic() roll over Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-12-05 12:12 -0500
Re: time.monotonic() roll over Marko Rauhamaa <marko@pacujo.net> - 2014-12-05 08:17 +0200
Re: time.monotonic() roll over Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-12-05 12:31 -0500
Re: time.monotonic() roll over Akira Li <4kir4.1i@gmail.com> - 2014-12-05 12:48 +0300
Re: time.monotonic() roll over Chris Angelico <rosuav@gmail.com> - 2014-12-05 03:12 +1100
Re: time.monotonic() roll over random832@fastmail.us - 2014-12-04 11:51 -0500
Re: time.monotonic() roll over Nobody <nobody@nowhere.invalid> - 2014-12-05 00:54 +0000
csiph-web