Skip to content

Commit

Permalink
human-readable: add an "i" to unit to indicate binary (1024) base
Browse files Browse the repository at this point in the history
  • Loading branch information
eworm-de committed Apr 9, 2024
1 parent 53a47b6 commit 6abcd9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ char *do_big_num(int64 num, int human_flag, const char *fract)
break;
}

snprintf(bufs[n], sizeof bufs[0], "%.*f%c", precision,
(double) num / powi, *units);
snprintf(bufs[n], sizeof bufs[0], "%.*f%c%s", precision,
(double) num / powi, *units, num > mult && mult == 1024 ? "i" : "");
return bufs[n];
}

Expand Down
2 changes: 2 additions & 0 deletions rsync.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3312,6 +3312,8 @@ expand it.
(mega), `G` (giga), `T` (tera), `P` (peta), `E` (exa), `Z` (zetta) or `Y`
(yotta). For example, a 1234567-byte file would output as 1.23M in level-2
(assuming that a period is your local decimal point).
Additionally an `i` is appended in level-3 to indicate the binary base.
The same file would output as 1.17Mi in level-3.

Backward compatibility note: versions of rsync prior to 3.1.0 do not
support human-readable level 1, and they default to level 0. Thus,
Expand Down

0 comments on commit 6abcd9b

Please sign in to comment.