diff --git a/common/load.cc b/common/load.cc index 31d0160..092ba8f 100644 --- a/common/load.cc +++ b/common/load.cc @@ -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 diff --git a/common/main.cc b/common/main.cc index a792c62..fa68ee1 100644 --- a/common/main.cc +++ b/common/main.cc @@ -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 ) {