X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 28 Mar 2012 09:40:07 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: clock_getres(CLOCK_REALTIME, .) may return an outdated and too high resolution Message-ID: <20120328074007.GE25716@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20120322093340 DOT GW18032 AT calimero DOT vinschen DOT de> <4F6B65A7 DOT 9080605 AT t-online DOT de> <20120326085159 DOT GJ2425 AT calimero DOT vinschen DOT de> <4F70A0C9 DOT 5060208 AT t-online DOT de> <20120327091051 DOT GB30721 AT calimero DOT vinschen DOT de> <4F72007D DOT 6080503 AT t-online DOT de> <20120327182823 DOT GV30721 AT calimero DOT vinschen DOT de> <4F720E19 DOT 5000809 AT t-online DOT de> <20120327205050 DOT GB25716 AT calimero DOT vinschen DOT de> <4F7230FD DOT 7080500 AT t-online DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4F7230FD.7080500@t-online.de> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 27 23:28, Christian Franke wrote: > Corinna Vinschen wrote: > >On Mar 27 20:59, Christian Franke wrote: > >>>>Sorry, I probably forgot to mention that NtSetTimerResolution > >>>>returns the same useless actual value than NtQueryTimerResolution. > >>>> > >>>>I would suggest: > >>>> > >>>> status = NtSetTimerResolution (period, TRUE,&actual); > >>>> if (!NT_SUCCESS (status)) > >>>> { ... return -1; } > >>>> - minperiod = actual; > >>>> + minperiod = period; > >>>But that's not right. The "actual" value is not useless, but the value > >>>the resolution has actually been set to. > >>No, again this is the minimum of all resolutions currently set by > >>all processes. > >> > >> > >>> The OS just doesn't support > >>>arbitrary values for the period. > >>> > >>Yes - but in 'actual' a smaller value than the value set for the > >>current process may be returned. > >Hmpf, ok. Boy is that ugly. > > Yes, aka broken by design :-) > > There should be a function to query the actual setting for the > current process only. But there is none. > > > > Is there a chance that actual is bigger > >than period? In that case we should perhaps set minperiod like this: > > > > minperiod = MAX (actual, period); > > According to some experiments this can only happen if period < > finest. In this case NtSetTimerResolution also succeeds and returns > actual == finest. Since period < finest can't happen, I set minperiod to period now as you suggested. But, frankly, this would have been much simpler if you would have send a patch right from the start ;) 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