Ubuntu Desktop Unit Consistency (LP: #369525)

Christopher Chan christopher.chan at bradbury.edu.hk
Mon Jun 1 01:12:37 UTC 2009


Lars Wirzenius wrote:
> 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.
>   
This is wrong in imho.

RAM comes in multiples of 1024. Network throughput is also in multiples 
of 1024. Disk storage is expressed in multiples of 1024 under any 
operating system. base-10 kilobytes/kilobits/whateverbytes/whateverbits 
are only used by disk manufacturers (hence the 'discrepancy' between 
that the label on the disk says and what the operating system says) and 
misconceptions of certain network equipment manufacturers (eg: 
100megabit/1000megabit) being base-10.

Each block on disk remains 512 bits (half a proper kilobyte) and so 
going for base-10 kilobytes requires translation while using proper 
kilobytes requires no translation.

base-10 kilobytes/megabytes/gigabytes have no place in software. They 
belong solely on hard disk labels along with their footnote indicating 
that they are the wrong kilobyte/megabyte/gigabyte definition.

> 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.
>
>
>
>   

Take that up with the GlibC guys and/or the C/C++ standards body if you 
wish and I personally do not want to see any distribution specific 
library of such functions and the resulting distribution specific 
patches of packages to use that library.




More information about the Ubuntu-devel-discuss mailing list