Ubuntu Desktop Unit Consistency (LP: #369525)

Lars Wirzenius lars at ubuntu.com
Sun May 31 17:32:09 UTC 2009


to, 2009-05-28 kello 23:23 +0200, Benjamin Drung kirjoitti:
> There is currently an inconsistency with units across the Ubuntu
> desktop. Some applications (such as gvfs) use legacy units, such as a
> 1024-byte kilobyte. Others (such as System Monitor) use international
> standard units, such as a 1000-byte kilobyte. Ubuntu should decide its
> units philosophy and apply it consistently across the desktop.

Ubuntu has, pretty much, decided on base-10 kilobytes.

A thought: Quite a number of programs need to convert sizes and other
amounts into units suitable for the user. While this is reasonably easy
to do (unless you want to be fancy), it's silly to duplicate the code
everywhere. Wouldn't it be sensible to add some functions to, say, glib
to do this? Something like:

        char *unit_format_time(double seconds);
        char *unit_format_filesize(long long bytes);
        
        unit_format_time(1) would return "1 s"
        
        unit_format_filesize(1024) would return, depending on user
        preferences and software context, "1 kB 24 bytes", "1 kilobyte",
        or
        "1 KiB" (user could indicate preference for power-of-2
        kilobytes).

Such functions could be made fancy to allow things like
unit_format_filesize(1500) returning either "1.5 kilobytes" or "1 kB 500
B", depending on the number of significant digits desired.






More information about the Ubuntu-devel-discuss mailing list