]> git.ipfire.org Git - thirdparty/iproute2.git/commit
lib: print_color_rate(): Fix formatting small rates in IEC mode
authorPetr Machata <me@pmachata.org>
Sat, 5 Dec 2020 21:13:33 +0000 (22:13 +0100)
committerDavid Ahern <dsahern@gmail.com>
Wed, 9 Dec 2020 02:30:41 +0000 (02:30 +0000)
commitaaeda2a7687c8223b23aeb154beda6ac8c09b75f
treed71a3fb8915ac27fe524753743d554eaf227b3aa
parenta0a4b6618c1fd54175a187f0ae538c872aba1b1c
lib: print_color_rate(): Fix formatting small rates in IEC mode

ISO/IEC units are distinguished from the decadic ones by using a prefixes
like "Ki", "Mi" instead of "K" and "M". The current code inserts the letter
"i" after the decadic unit when in IEC mode. However it does so even when
the prefix is an empty string, formatting 1Kbit in IEC mode as "1000ibit".
Fix by omitting the letter if there is no prefix.

Signed-off-by: Petr Machata <me@pmachata.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
lib/json_print.c