Skip to content

Commit

Permalink
humanTimeUnit 27b
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer09 committed Jan 8, 2025
1 parent eb05287 commit bfcc417
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions linux/GPUMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ static int humanTimeUnit(char* buffer, size_t size, unsigned long long int value
value /= 100;

if (value < 10000)
return xSnprintf(buffer, size, ".%04us", (unsigned int)value);
return xSnprintf(buffer, size, "%.u.%04us", (unsigned int)((uint32_t)value / 10000), (unsigned int)((uint32_t)value % 10000));

value /= 10; // milliseconds
//value /= 10; // milliseconds

if (value < 10000)
return xSnprintf(buffer, size, "%u.%03us", (unsigned int)value / 1000, (unsigned int)value % 1000);
if (value < 100000)
return xSnprintf(buffer, size, "%u.%03us", (unsigned int)((uint32_t)value / 10000), (unsigned int)((uint32_t)value % 10000) / 10);

//value /= 10;

if (value < 60000)
return xSnprintf(buffer, size, "%u.%02us", (unsigned int)value / 1000, ((unsigned int)value % 1000) / 10);
if (value < 600000)
return xSnprintf(buffer, size, "%u.%02us", (unsigned int)((uint32_t)value / 10000), (unsigned int)((uint32_t)value % 10000) / 100);

value /= 1000; // seconds
value /= 10000; // seconds

if (value < 3600)
return xSnprintf(buffer, size, "%2um%02us", (unsigned int)value / 60, (unsigned int)value % 60);
Expand Down

0 comments on commit bfcc417

Please sign in to comment.