feat: moved from binary to metric based size units to have the same calculation as macOS (#2230)

This commit is contained in:
Serhiy Mytrovtsiy
2024-12-17 14:13:58 +01:00
parent 8a99997f86
commit 3887157a7c
4 changed files with 50 additions and 35 deletions

View File

@@ -382,13 +382,13 @@ extension SizeUnit: CaseIterable {
public func toBytes(_ value: Int) -> Int {
switch self {
case .KB:
return value * 1_024
return value * 1_000
case .MB:
return value * 1_024 * 1_024
return value * 1_000 * 1_000
case .GB:
return value * 1_024 * 1_024 * 1_024
return value * 1_000 * 1_000 * 1_000
case .TB:
return value * 1_024 * 1_024 * 1_024 * 1_024
return value * 1_000 * 1_000 * 1_000 * 1_000
default:
return value
}