Commit 5ce0c1e8 authored by Gabriel Kerneis's avatar Gabriel Kerneis

Flawed logic in timeval_minus

parent 81306c60
...@@ -45,7 +45,7 @@ void ...@@ -45,7 +45,7 @@ void
timeval_minus(struct timeval *d, timeval_minus(struct timeval *d,
const struct timeval *s1, const struct timeval *s2) const struct timeval *s1, const struct timeval *s2)
{ {
if(s1->tv_usec > s2->tv_usec) { if(s1->tv_usec >= s2->tv_usec) {
d->tv_usec = s1->tv_usec - s2->tv_usec; d->tv_usec = s1->tv_usec - s2->tv_usec;
d->tv_sec = s1->tv_sec - s2->tv_sec; d->tv_sec = s1->tv_sec - s2->tv_sec;
} else { } else {
......
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