From ed721374fe983a6bfe146ee0885b8a01cc999927 Mon Sep 17 00:00:00 2001 From: zhongzm Date: Fri, 17 Jan 2025 17:17:30 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E9=80=9F=E7=8E=87=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/units.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/units.ts b/src/utils/units.ts index 85a1b9f..4e0e39d 100644 --- a/src/utils/units.ts +++ b/src/utils/units.ts @@ -16,10 +16,10 @@ export function convertBandwidth(value: number, fromUnit: BandwidthUnit, toUnit: } export function formatBandwidth(kbpsValue: number): { value: number; unit: BandwidthUnit } { - if (kbpsValue >= 1048576) { - return { value: kbpsValue / 1048576, unit: 'Gbps' }; - } else if (kbpsValue >= 1024) { - return { value: kbpsValue / 1024, unit: 'Mbps' }; + if (kbpsValue >= 1000000) { + return { value: kbpsValue / 1000000, unit: 'Gbps' }; + } else if (kbpsValue >= 1000) { + return { value: kbpsValue / 1000, unit: 'Mbps' }; } return { value: kbpsValue, unit: 'Kbps' }; }