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


Andrew Makhorin wrote:

> double get_time(void)
> {     struct timeval tv;
>      gettimeofday(&tv, NULL);
>      return (double)tv.tv_sec + 1e-6 * (double)tv.tv_usec;
> }

I would be suspicious of floating-point rounding errors here for the 
original problem you described.  Why don't you try a test case that just 
checks if one tv is ever less than a previous tv, without the conversions.


Cary





--
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]