sched/irq/irq_procfs.c: Fix occasional computation error when fracpart >= 1000

This commit is contained in:
Xiang Xiao 2018-08-24 15:16:01 -06:00 committed by Gregory Nutt
parent d38be46655
commit 2aa208ccf0

View File

@ -226,9 +226,9 @@ static int irq_callback(int irq, FAR struct irq_info_s *info,
} }
else else
{ {
uint64_t intcount = ((uint64_t)intpart * elapsed) / TICK_PER_SEC; uint64_t intcount = ((uint64_t)intpart * elapsed);
fracpart = (unsigned int) fracpart = (unsigned int)
(((copy.count - intcount) * TICK_PER_SEC * 1000) / elapsed); (((copy.count * TICK_PER_SEC - intcount) * 1000) / elapsed);
} }
/* Make sure that the count is representable with snprintf format */ /* Make sure that the count is representable with snprintf format */