This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strange bug in gettimeofday function


On 2/11/07, Christopher Faylor wrote:
On Sun, Feb 11, 2007 at 07:20:14PM +0300, Andrew Makhorin wrote:
>Hi,
>
>I detected a strange bug in the standard function gettimeofday.
>It *sometimes* reports the time which being expressed as the integer
>number of milliseconds is *less* than the time obtained *earlier* with
>the same function.
>
>The expression 1000000 * tv.tv_sec + tv.tv_usec is calculated in
>64-bit arithmetic, so overflow cannot happen. The negative difference
>in the time values on two successive calls is about 100 milliseconds.
>
>cygcheck.out is attached.

In cases like this a simple test case is really required.  If this is
really true then calling gettimeofday in a loop should be enough to
demonstrate the problem.

I have a hunch that it will be a good idea to have a look at what the result of GetSystemTimeAdjustment() is on the machine exhibiting this behaviour, at the time it exhibits this behaviour.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]