Commit 17362c97 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix bug in timeval_minus_msec.

parent 5dd30164
......@@ -93,8 +93,9 @@ timeval_minus_msec(const struct timeval *s1, const struct timeval *s2)
return 2000000000;
if(s1->tv_sec > s2->tv_sec)
return (unsigned)(s1->tv_sec - s2->tv_sec) * 1000u +
(unsigned)(s1->tv_usec - s2->tv_usec) / 1000u;
return
(unsigned)((unsigned)(s1->tv_sec - s2->tv_sec) * 1000 +
((int)s1->tv_usec - s2->tv_usec) / 1000);
if(s1->tv_usec <= s2->tv_usec)
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment