diff options
| author | Martin Ridgers <[email protected]> | 2021-10-11 10:32:13 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-10-11 10:32:13 +0200 |
| commit | 735b478c1425cc9a1e407bf917dc8daa4ab16b11 (patch) | |
| tree | 6e253ee94a5db9244756571084f3f07472e4e2b3 /zencore/string.cpp | |
| parent | Fixed undefined mimalloc symbols (diff) | |
| parent | iobuffer: Changed MakeFromTemporaryFile so it accepts a path instead of a cha... (diff) | |
| download | zen-735b478c1425cc9a1e407bf917dc8daa4ab16b11.tar.xz zen-735b478c1425cc9a1e407bf917dc8daa4ab16b11.zip | |
Merged main
Diffstat (limited to 'zencore/string.cpp')
| -rw-r--r-- | zencore/string.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/zencore/string.cpp b/zencore/string.cpp index 4bf0378b2..efa84ea73 100644 --- a/zencore/string.cpp +++ b/zencore/string.cpp @@ -341,7 +341,17 @@ NiceBytesToBuffer(uint64_t Num, std::span<char> Buffer) size_t NiceByteRateToBuffer(uint64_t Num, uint64_t ElapsedMs, std::span<char> Buffer) { - size_t n = NiceNumGeneral(Num * 1000 / ElapsedMs, Buffer, kNicenumBytes); + size_t n = 0; + + if (ElapsedMs) + { + n = NiceNumGeneral(Num * 1000 / ElapsedMs, Buffer, kNicenumBytes); + } + else + { + Buffer[n++] = '0'; + Buffer[n++] = 'B'; + } Buffer[n++] = '/'; Buffer[n++] = 's'; |