Poco test using clock_gettime() and gettimeofday()

David Stacey drstacey@tiscali.co.uk
Mon Nov 17 18:53:00 GMT 2014

On 17/11/14 12:41, Corinna Vinschen wrote:
> On Nov 15 16:56, David Stacey wrote:
>>   I'm not convinced that the test is valid. Poco seems to be making
>>   assumptions about clock_gettime() and gettimeofday() that simply aren't
>>   guaranteed to hold - but obviously do in Fedora at least. For instance, the
>>   test must be assuming that either the accuracy of the two routines is
>>   identical, or be making assumptions about rounding in the less accurate
>>   routine.
>>   I think it would be better to patch the test so that it uses clock_gettime()
>>   exclusively (and not gettimeofday() at all), and then this problem will
>>   disappear. But I thought I would submit it here to see what you thought
>>   before raising a ticket with the Poco developers.
>>   What do you think?
> Same as you.  One problem is that CLOCK_REALTIME (which is the one used
> by gettimeofday) is not monotonic by definition, see for instance the
> Linux man page:
>    This  clock is  affected by discontinuous jumps in the system time
>    (e.g., if the system administrator manually changes the clock), and by
>    the incremental adjustments performed by adjtime(3) and NTP.
> The second problem, and that's the one affecting this testcase mostly,
> is the accuracy of the timer (see clock_getres function).

Thank you for confirming my suspicions. I'll patch the test and roll a 
poco-1.4.7 later in the week. I'll also raise a ticket and get this 
fixed upstream.

Thanks once again,


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

More information about the Cygwin mailing list