mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-05-06 03:07:58 +00:00
Tweak bandwidth numbers formatting (#101)
This commit is contained in:
@@ -82,10 +82,12 @@ function formatMemory(kbs: number, stamp: Maybe<Types.Timestamp>): string {
|
||||
function formatBandwidth(bps: number, stamp: Maybe<Types.Timestamp>): string {
|
||||
const ago = stamp ? ` (${formatStamp(stamp)})` : '';
|
||||
|
||||
if (bps >= 1000) {
|
||||
if (bps >= 1024 * 1024) {
|
||||
return `${(bps / (1024 * 1024)).toFixed(1)} MB/s${ago}`;
|
||||
} else if (bps >= 1000) {
|
||||
return `${(bps / 1024).toFixed(1)} kB/s${ago}`;
|
||||
} else {
|
||||
return `${bps} B/s${ago}`;
|
||||
return `${bps | 0} B/s${ago}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user