Skip to content

Commit

Permalink
humanTimeUnit 28f
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Jan 8, 2025
1 parent 8f2c11a commit ce24fee
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions linux/GPUMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ce24fee

Please sign in to comment.