From 2aa208ccf06933b3e3a3953ce41fdaec16dd8db7 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 24 Aug 2018 15:16:01 -0600 Subject: [PATCH] sched/irq/irq_procfs.c: Fix occasional computation error when fracpart >= 1000 --- sched/irq/irq_procfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sched/irq/irq_procfs.c b/sched/irq/irq_procfs.c index 68933e7ac8..c4cdcb4c9f 100644 --- a/sched/irq/irq_procfs.c +++ b/sched/irq/irq_procfs.c @@ -226,9 +226,9 @@ static int irq_callback(int irq, FAR struct irq_info_s *info, } else { - uint64_t intcount = ((uint64_t)intpart * elapsed) / TICK_PER_SEC; + uint64_t intcount = ((uint64_t)intpart * elapsed); 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 */