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
F12843226: D10631.id25520.diff
Thu, Mar 28, 10:36 PM
Unknown Object (File)
Feb 2 2024, 12:22 PM
Unknown Object (File)
Jan 29 2024, 1:36 PM
Unknown Object (File)
Jan 15 2024, 9:57 PM
Unknown Object (File)
Jan 8 2024, 5:09 PM
Unknown Object (File)
Jan 3 2024, 6:27 PM
Unknown Object (File)
Dec 30 2023, 4:55 PM
Unknown Object (File)
Dec 26 2023, 6:02 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
Branch
siunits
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 2729
Build 2733: [Placeholder Plan] Wait for 30 Seconds

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.