time: fix overflow in timeval_add_msec()
authorChris Taylor <ctaylor@pivot3.com>
Sun, 2 Apr 2017 21:54:02 +0000 (15:54 -0600)
committerJens Axboe <axboe@fb.com>
Sun, 2 Apr 2017 21:54:02 +0000 (15:54 -0600)
commitd19251c4a191dd024bec82be876f57f7770e32f6
treeadbfe43cf419e53faf4272b70d1b406e4e8845ca
parent618ee94c319c46c670d29c7cf71538ca2ace13b7
time: fix overflow in timeval_add_msec()

There is an issue in FIO when using the detailed bandwidth and iops
logging with averaging over a period of time > 1 second.  It seems that
usecs overflows which later causes negative time diff values resulting
in skewed toward 0 results.  I have attached a potential fix that should
prevent usecs from going beyond 1000000.

[Modified by Jens to put the adj_sec in the branch.]

Signed-off-by: Jens Axboe <axboe@fb.com>
time.c