Recent changes (master)
The following changes since commit 168bb5875da97004163c6b755de162ad481134c4:
doc: latency log unit is nsec (2017-08-17 15:39:56 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to deeb3c11c212e99e8d1162e03e0ef734bd0d01a7:
Merge branch 'timespec_add_msec_overflow' of https://github.com/sitsofe/fio (2017-08-22 10:32:18 -0600)
----------------------------------------------------------------
Jens Axboe (1):
Merge branch 'timespec_add_msec_overflow' of https://github.com/sitsofe/fio
Sitsofe Wheeler (1):
time: fix overflow in timespec_add_msec
time.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
---
Diff of recent changes:
time.c +5 -5
@@ -8,17 +8,17 @@ static unsigned long ns_granularity;void timespec_add_msec (struct timespec *ts,unsigned int msec) { -unsigned long adj_nsec =1000000 * msec; +uint64_t adj_nsec =1000000ULL * msec; ts->tv_nsec += adj_nsec;if (adj_nsec >=1000000000 ) { -unsigned long adj_sec = adj_nsec /1000000000UL ; +uint64_t adj_sec = adj_nsec /1000000000 ; - ts->tv_nsec -= adj_sec *1000000000UL ; + ts->tv_nsec -= adj_sec *1000000000 ; ts->tv_sec += adj_sec; } -if (ts->tv_nsec >=1000000000UL ){ - ts->tv_nsec -=1000000000UL ; +if (ts->tv_nsec >=1000000000 ){ + ts->tv_nsec -=1000000000 ; ts->tv_sec++; } }