From 1dc914a675aa41a09762ab4a83318a481f96e429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E7=89=9B?= <81887980+Wenz-jam@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:09:54 +0800 Subject: [PATCH] fix uint32_t overflow in format_time --- benchmarks/microbench/src/bench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/microbench/src/bench.c b/benchmarks/microbench/src/bench.c index af4a537..bfb48b6 100644 --- a/benchmarks/microbench/src/bench.c +++ b/benchmarks/microbench/src/bench.c @@ -12,7 +12,7 @@ static uint64_t uptime() { return io_read(AM_TIMER_UPTIME).us; } static char *format_time(uint64_t us) { static char buf[32]; - uint32_t ms = us / 1000; + uint64_t ms = us / 1000; us -= ms * 1000; assert(us < 1000); int len = sprintf(buf, "%d.000", ms);