How should I display units in my application?
There is inconsistency in how various operating systems display file size units. Windows shows base 2, MacOSX shows base 10. Does Ubuntu have guidelines for this?
Solution 1:
Ubuntu does have a policy for this. The basic gist is as follows:
Use base-10 for network bandwidth (e.g. 6 Mbit/s or 50 kB/s) and disk sizes (e.g. 500 GB hard drive or 4.7 GB DVD). When using base-10, follow the SI standard for prefixes (e.g. kB, MB).
Use base-2 for RAM sizes (e.g. 2 GiB RAM). When using base-2, follow the IEC standard for prefixes (e.g. KiB, MiB).
There is the library libkibi, available starting with Ubuntu 11.04, that provides helper functions for formatting sizes appropriately.