mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Pretty функционал будет в утилитах
This commit is contained in:
12
src/utils/Pretty.cpp
Normal file
12
src/utils/Pretty.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "Utils/Pretty.h"
|
||||
|
||||
String prettyBytes(size_t size) {
|
||||
if (size < 1024)
|
||||
return String(size) + "b";
|
||||
else if (size < (1024 * 1024))
|
||||
return String(size / 1024.0) + "kB";
|
||||
else if (size < (1024 * 1024 * 1024))
|
||||
return String(size / 1024.0 / 1024.0) + "MB";
|
||||
else
|
||||
return String(size / 1024.0 / 1024.0 / 1024.0) + "GB";
|
||||
}
|
||||
Reference in New Issue
Block a user