1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:47:35 +00:00

AK: Add an option to format numbers with 1000 based units

Instead of only allowing 1024-based units.
This commit is contained in:
Arda Cinar 2022-12-15 16:31:38 +03:00 committed by Sam Atkins
parent ccb6b4f943
commit 0dbb1be81c
2 changed files with 12 additions and 8 deletions

View file

@ -10,9 +10,13 @@
namespace AK {
// TODO: Add an optional base here for binary vs si units
DeprecatedString human_readable_size(u64 size);
DeprecatedString human_readable_quantity(u64 quantity, StringView unit = "B"sv);
enum class HumanReadableBasedOn {
Base2,
Base10
};
DeprecatedString human_readable_size(u64 size, HumanReadableBasedOn based_on = HumanReadableBasedOn::Base2);
DeprecatedString human_readable_quantity(u64 quantity, HumanReadableBasedOn based_on = HumanReadableBasedOn::Base2, StringView unit = "B"sv);
DeprecatedString human_readable_size_long(u64 size);
DeprecatedString human_readable_time(i64 time_in_seconds);