Merge pull request #69 from thewtex/consistent-precision

consistent precision
This commit is contained in:
Matt McCormick 2021-08-03 18:43:21 -04:00 committed by GitHub
commit 0ca29c4ecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

@ -39,6 +39,8 @@ std::string load_string( bool use_colors,
short num_averages )
{
std::ostringstream ss;
ss.setf( std::ios::fixed, std::ios::floatfield );
ss.precision( 2 );
double averages[num_averages];
// based on: opensource.apple.com/source/Libc/Libc-262/gen/getloadavg.c

@ -87,7 +87,10 @@ std::string cpu_string( CPU_MODE cpu_mode, unsigned int cpu_usage_delay, unsigne
oss << "]";
}
oss.width( 5 );
oss << percentage * multiplier;
oss.setf( std::ios::fixed, std::ios::floatfield );
oss.precision( 1 );
oss.fill( ' ' );
oss << std::right << percentage * multiplier;
oss << "%";
if( use_colors )
{