delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/22/05:34:43

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 22 Mar 2012 10:33:40 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: clock_getres(CLOCK_REALTIME, .) may return an outdated and too high resolution
Message-ID: <20120322093340.GW18032@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4F6A5D42 DOT 3030108 AT t-online DOT de>
MIME-Version: 1.0
In-Reply-To: <4F6A5D42.3030108@t-online.de>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar 21 23:59, Christian Franke wrote:
> clock_getres(CLOCK_REALTIME, &ts) queries the actual resolution through
> NtQueryTimerResolution (&coarsest, &finest, &actual) during its
> first call and returns this value unchanged afterwards.
> 
> This returns a global Windows setting which may be temporarily
> modified by other applications by using e.g. timeBegin/EndPeriod().
> For example playing a flash video in browser sets the resolution to
> 1ms. It is reset to default ~15ms when the browser is closed.
> 
> As a consequence the actual resolution might be much lower than
> reported by clock_getres() when clock_gettime() is used for
> measurements later. It would IMO be better to return the 'coarsest'
> instead of the 'actual' value.

clock_getres already returns the coarsest time.  Did you mean the
setting in hires_ms::resolution, by any chance?  It's using the
actual setting right now.

> If clock_setres() is used, this setting should be returned instead
> of the 'actual' value at the time of the setting.

Well, I'm not overly concerned about clock_setres, given that it's
probably not used at all :)

> BTW: GetSystemTimeAsFileTime() apparently provides the same
> resolution (at least on Win7 x64). So the more complex use of
> SharedUserData.InterruptTime may have less benefit than expected.

On pre-Vista, the accuracy of GetSystemTimeAsFileTime is 15.625 ms,
fixed.  On Vista and later it seems to be 15ms or better, but its
resultion is not constant anymore.

But I'm not shure either, if the timeGetTime_ns shuffle has any positive
effect.  Given that we allow a jitter of 40 ms, we''re potentially worse
off than by just calling GetSystemTimeAsFileTime and be done with it.
Also, all processes would be guaranteed to be on the same time, not only
the processes within the same session sharing gtod.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019