From: Richard F. <gol...@gm...> - 2011-06-15 01:33:32
|
On Tue, Jun 14, 2011 at 04:52, Olivier AUDRY <oli...@co...> wrote: > sub octets_to_human > 2 { > 5 my $size = shift; > 7 if ($size > 1099511627776) # TiB: 1024 GiB > 8 { > 9 return sprintf("%.2f TiB", $size / 1099511627776); > 10 } > 11 elsif ($size > 1073741824) # GiB: 1024 MiB > 12 { > 13 return sprintf("%.2f GiB", $size / 1073741824); > 14 } [snip] There's a SPEED transform already implemented, with an automatic ending of "bps". If this ending and SI prefixes (instead of binary prefixes) are acceptable, all is well, no modifications required. If you want to remove this ending, you should be able to do it with a negative SUBSTR transform; I submitted http://sourceforge.net/tracker/?func=detail&aid=2963118&group_id=160720&atid=816979 but I'm not sure if it was accepted (due to lack of persuasive use case). A very low impact patch. If you insist on binary prefixes, duplicating the speeds array/trans_speed function in dm_tests.pm is fairly straightforward, but that's a much bigger patch. |