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