From 62897ffea9bf02615a6fcae8f3753cb3171d3a66 Mon Sep 17 00:00:00 2001 From: Hongyang Zhou Date: Thu, 5 Dec 2024 13:11:31 -0500 Subject: [PATCH] Roundoff file size --- src/io.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/io.jl b/src/io.jl index 7db19d86..e0f8b5a9 100644 --- a/src/io.jl +++ b/src/io.jl @@ -676,14 +676,15 @@ end function Base.show(io::IO, data::BATS) showhead(io, data) if data.list.bytes ≥ 1e9 - println(io, "filesize: $(data.list.bytes/1e9) GB") + str = @sprintf "filesize: %.1f GB" data.list.bytes/1e9 elseif data.list.bytes ≥ 1e6 - println(io, "filesize: $(data.list.bytes/1e6) MB") + str = @sprintf "filesize: %.1f MB" data.list.bytes/1e6 elseif data.list.bytes ≥ 1e3 - println(io, "filesize: $(data.list.bytes/1e3) KB") + str = @sprintf "filesize: %.1f KB" data.list.bytes/1e3 else - println(io, "filesize: $(data.list.bytes) bytes") + str = @sprintf "filesize: %.1f Bytes" data.list.bytes end + println(io, str) println(io, "snapshots: $(data.list.npictinfiles)") end