From ce24fee56fcce4c7fb8e74509ba73ea3dead960a Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Fri, 20 Dec 2024 04:34:21 +0800 Subject: [PATCH] humanTimeUnit 28f --- linux/GPUMeter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/linux/GPUMeter.c b/linux/GPUMeter.c index a3e2dd906..b73fb4dee 100644 --- a/linux/GPUMeter.c +++ b/linux/GPUMeter.c @@ -57,13 +57,12 @@ static int humanTimeUnit(char* buffer, size_t size, unsigned long long totalNano unsigned long long totalSeconds = value / 10000; if (totalSeconds < 60) { int width = 4; - unsigned int seconds = (unsigned int)(value / 10000); unsigned int fraction = (unsigned int)(value % 10000); - for (unsigned int limit = 1; seconds >= limit; limit *= 10) { + for (unsigned int limit = 1; (unsigned int)totalSeconds >= limit; limit *= 10) { width--; fraction /= 10; } - return xSnprintf(buffer, size, "%.u.%0*us", seconds, width, fraction); + return xSnprintf(buffer, size, "%.u.%0*us", (unsigned int)totalSeconds, width, fraction); } value = totalSeconds;