oops this needs to be first
This commit is contained in:
15
main.cpp
15
main.cpp
@@ -31,6 +31,14 @@ struct mem_usage_t {
|
||||
bool daemon_mode = false;
|
||||
|
||||
/* DISPLAY FUNCS */
|
||||
// converts number to string with given decimal places
|
||||
std::string pNum(auto num, uint8_t decs = 0) {
|
||||
std::stringstream ret;
|
||||
ret << std::fixed << std::setprecision(decs) << num;
|
||||
return ret.str();
|
||||
}
|
||||
|
||||
|
||||
// converts large number in (k)bytes to human readable numer with suffix and sane decimal
|
||||
std::string pBytes(double bytes, bool isKbytes = false) {
|
||||
std::array suffix_list = {'K', 'M', 'G', 'T', 'P', 'E', 'Z'};
|
||||
@@ -47,13 +55,6 @@ std::string pBytes(double bytes, bool isKbytes = false) {
|
||||
return "++++";
|
||||
}
|
||||
|
||||
// converts number to string with given decimal places
|
||||
std::string pNum(auto num, uint8_t decs = 0) {
|
||||
std::stringstream ret;
|
||||
ret << std::fixed << std::setprecision(decs) << num;
|
||||
return ret.str();
|
||||
}
|
||||
|
||||
// pads given string to length
|
||||
std::string pad(std::string s, uint8_t len, bool ljust = false) {
|
||||
if (len > s.size())
|
||||
|
||||
Reference in New Issue
Block a user