mirror of
https://github.com/transmission/transmission
synced 2024-12-23 16:24:02 +00:00
fix: max 4 significant digits for speed (#5100)
This commit is contained in:
parent
63653b4831
commit
03a23cf797
1 changed files with 5 additions and 5 deletions
|
@ -160,24 +160,24 @@
|
||||||
|
|
||||||
+ (NSString*)stringForSpeed:(CGFloat)speed kb:(NSString*)kb mb:(NSString*)mb gb:(NSString*)gb
|
+ (NSString*)stringForSpeed:(CGFloat)speed kb:(NSString*)kb mb:(NSString*)mb gb:(NSString*)gb
|
||||||
{
|
{
|
||||||
if (speed <= 999.95) //0.0 KB/s to 999.9 KB/s
|
if (speed < 999.95) // 0.0 KB/s to 999.9 KB/s
|
||||||
{
|
{
|
||||||
return [NSString localizedStringWithFormat:@"%.1f %@", speed, kb];
|
return [NSString localizedStringWithFormat:@"%.1f %@", speed, kb];
|
||||||
}
|
}
|
||||||
|
|
||||||
speed /= 1000.0;
|
speed /= 1000.0;
|
||||||
|
|
||||||
if (speed <= 99.995) //1.00 MB/s to 99.99 MB/s
|
if (speed < 99.995) // 1.00 MB/s to 99.99 MB/s
|
||||||
{
|
{
|
||||||
return [NSString localizedStringWithFormat:@"%.2f %@", speed, mb];
|
return [NSString localizedStringWithFormat:@"%.2f %@", speed, mb];
|
||||||
}
|
}
|
||||||
else if (speed <= 999.95) //100.0 MB/s to 999.9 MB/s
|
else if (speed < 999.95) // 100.0 MB/s to 999.9 MB/s
|
||||||
{
|
{
|
||||||
return [NSString localizedStringWithFormat:@"%.1f %@", speed, mb];
|
return [NSString localizedStringWithFormat:@"%.1f %@", speed, mb];
|
||||||
}
|
}
|
||||||
else //insane speeds
|
else // insane speeds
|
||||||
{
|
{
|
||||||
return [NSString localizedStringWithFormat:@"%.2f %@", (speed / 1000.0), gb];
|
return [NSString localizedStringWithFormat:@"%.2f %@", speed / 1000.0, gb];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue