Page MenuHomePhabricator

Use normal human units, not "correct" SI units, when parsing MB/GB etc
ClosedPublic

Authored by epriestley on Oct 2 2014, 8:34 PM.
Tags
None
Referenced Files
F14090730: D10631.diff
Sun, Nov 24, 7:55 PM
Unknown Object (File)
Thu, Nov 21, 3:39 AM
Unknown Object (File)
Sun, Nov 17, 3:00 AM
Unknown Object (File)
Oct 25 2024, 7:09 PM
Unknown Object (File)
Oct 25 2024, 3:20 PM
Unknown Object (File)
Oct 24 2024, 11:17 AM
Unknown Object (File)
Oct 15 2024, 12:31 AM
Unknown Object (File)
Oct 6 2024, 11:48 PM
Subscribers

Details

Summary

Technically, "KB" is "kilobyte" which is 1000 bytes, and "KiB" is "kibibyte" which is 1024 bytes. I implemented this function "correctly", but in practice we mostly use it to parse things from php.ini, mysql.cnf, etc., which all use units of 1024 intead of 1000. This ends up being really confusing because you write 128M in a file (technically meaning "128 mebibytes") and then a setup warning says 137M (technically meaning "137 megabytes").

Use the standard normal units that everyone and everything uses instead of the "correct" units. If we have some cause for the "real" SI units later we can mess with this stuff when we hit that.

Test Plan

Saw the setup check in D10630 actually report what I wrote in the file instead of a weird SI value.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Use normal human units, not "correct" SI units, when parsing MB/GB etc.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
chad added a reviewer: chad.
This revision is now accepted and ready to land.Oct 2 2014, 8:46 PM
This revision was automatically updated to reflect the committed changes.