From: Jens Axboe Date: Fri, 16 Mar 2012 12:55:27 +0000 (+0100) Subject: Fix wrap bug in mtime_since() X-Git-Tag: fio-2.0.6~7 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c03b373d2281ff4e0ad191d7afb66b459887394c Fix wrap bug in mtime_since() Signed-off-by: Jens Axboe --- diff --git a/time.c b/time.c index ef05094e..4af84bc7 100644 --- a/time.c +++ b/time.c @@ -48,16 +48,13 @@ unsigned long mtime_since(struct timeval *s, struct timeval *e) usec += 1000000; } + if (sec < 0 || (sec == 0 && usec < 0)) + return 0; + sec *= 1000UL; usec /= 1000UL; ret = sec + usec; - /* - * time warp bug on some kernels? - */ - if (ret < 0) - ret = 0; - return ret; }