| www.delorie.com/archives/browse.cgi | search | 
| X-Recipient: | archive-cygwin AT delorie DOT com | 
| X-SWARE-Spam-Status: | No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY | 
| X-Spam-Check-By: | sourceware.org | 
| Message-ID: | <4F6A5D42.3030108@t-online.de> | 
| Date: | Wed, 21 Mar 2012 23:59:14 +0100 | 
| From: | Christian Franke <Christian DOT Franke AT t-online DOT de> | 
| User-Agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2 | 
| MIME-Version: | 1.0 | 
| To: | cygwin AT cygwin DOT com | 
| Subject: | clock_getres(CLOCK_REALTIME, .) may return an outdated and too high resolution | 
| X-IsSubscribed: | yes | 
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm | 
| List-Id: | <cygwin.cygwin.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 | 
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. If clock_setres() is used, this setting should be returned instead of the 'actual' value at the time of the setting. 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. Christian -- 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
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |