[Mono-devel-list] bug in _wapi_calc_timeout
Martin Dvorak
mdvorak at ninell.cz
Mon May 12 06:37:19 EDT 2003
While trying to get mono working on FreeBSD 5-CURRENT, I've found a bug
in function _wapi_calc_timeout in mono/io-layer/misc.c. Current
implementation of this function may return timeout with tv_nsec > 10^9,
which is invalid on FreeBSD (guess should be invalid on every OS, but
...). I propose following implementation:
void _wapi_calc_timeout(struct timespec *timeout, guint32 ms)
{
struct timeval now;
div_t divvy;
gettimeofday(&now, NULL);
divvy=div(now.tv_usec+1000*(int)ms, 1000);
timeout->tv_sec=now.tv_sec+divvy.quot;
timeout->tv_nsec=divvy.rem*1000;
}
-md-
More information about the Mono-devel-list
mailing list