1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-14 17:21:04 +00:00
uutils-coreutils/tests
Jeffrey Finkelstein 2f56536637 dd: fix precision for display of total time spent
Improve the display of the total time spent transferring bytes so that
the number of seconds is displayed using the `%g` format specifier as
in `printf`. This matches the behavior of GNU `dd`.

Before this commit, the precision was always set to one digit after
the decimal point. For example,

    $ dd count=100000 if=/dev/zero of=/dev/null
    100000+0 records in
    100000+0 records out
    51200000 bytes (51 MB, 49 MiB) copied, 0.2 s, 268.1 MB/s

After this commit, the precision increases dynamically as the duration
decreases. For example,

    $ dd count=100000 if=/dev/zero of=/dev/null
    100000+0 records in
    100000+0 records out
    51200000 bytes (51 MB, 49 MiB) copied, 0.1019 s, 507 MB/s
    $ dd count=1000 if=/dev/zero of=/dev/null
    1000+0 records in
    1000+0 records out
    512000 bytes (512 kB, 500 KiB) copied, 0.002663 s, 256 MB/s
    $ dd count=10 if=/dev/zero of=/dev/null
    10+0 records in
    10+0 records out
    5120 bytes (5.1 kB, 5.0 KiB) copied, 0.000182 s, 5.1 MB/s
2023-03-11 22:37:43 -05:00
..
benches/factor all: remove explicit imports of TryFrom and TryInto 2022-04-05 10:39:31 +02:00
by-util dd: fix precision for display of total time spent 2023-03-11 22:37:43 -05:00
common dd: fix precision for display of total time spent 2023-03-11 22:37:43 -05:00
fixtures comm: implement --zero-terminated 2023-03-01 16:59:51 +01:00
test_util_name.rs chore: run cargo +nightly clippy --fix 2022-11-16 11:09:44 +02:00
tests.rs tests: do not generate module structure in build.rs 2022-10-05 13:30:22 +02:00