fix: add 'years' and 'Infinity' to ETA in transmission-remote (#5584)
This commit is contained in:
parent
280dea4e33
commit
d0b0810457
|
@ -118,7 +118,22 @@ static std::string etaToString(int64_t eta)
|
||||||
return fmt::format(FMT_STRING("{:d} hrs"), eta / (60 * 60));
|
return fmt::format(FMT_STRING("{:d} hrs"), eta / (60 * 60));
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt::format(FMT_STRING("{:d} days"), eta / (60 * 60 * 24));
|
if (eta < (60 * 60 * 24 * 30))
|
||||||
|
{
|
||||||
|
return fmt::format(FMT_STRING("{:d} days"), eta / (60 * 60 * 24));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eta < (60 * 60 * 24 * 30 * 12))
|
||||||
|
{
|
||||||
|
return fmt::format(FMT_STRING("{:d} months"), eta / (60 * 60 * 24 * 30));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eta < (60 * 60 * 24 * 365 * 1000LL)) // up to 999 years
|
||||||
|
{
|
||||||
|
return fmt::format(FMT_STRING("{:d} years"), eta / (60 * 60 * 24 * 365));
|
||||||
|
}
|
||||||
|
|
||||||
|
return "∞";
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string tr_strltime(time_t seconds)
|
static std::string tr_strltime(time_t seconds)
|
||||||
|
@ -1444,7 +1459,7 @@ static void printTorrentList(tr_variant* top)
|
||||||
double total_down = 0;
|
double total_down = 0;
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
"%6s %-4s %9s %-8s %6s %6s %-5s %-11s %s\n",
|
"%6s %-4s %9s %-9s %6s %6s %-5s %-11s %s\n",
|
||||||
"ID",
|
"ID",
|
||||||
"Done",
|
"Done",
|
||||||
"Have",
|
"Have",
|
||||||
|
@ -1484,7 +1499,7 @@ static void printTorrentList(tr_variant* top)
|
||||||
std::string{ "n/a" };
|
std::string{ "n/a" };
|
||||||
|
|
||||||
fmt::print(
|
fmt::print(
|
||||||
FMT_STRING("{:6d}{:c} {:>4s} {:>9s} {:<8s} {:6.1f} {:6.1f} {:>5s} {:<11s} {:s}\n"),
|
FMT_STRING("{:6d}{:c} {:>4s} {:>9s} {:<9s} {:6.1f} {:6.1f} {:>5s} {:<11s} {:s}\n"),
|
||||||
torId,
|
torId,
|
||||||
error_mark,
|
error_mark,
|
||||||
done_str,
|
done_str,
|
||||||
|
@ -1503,7 +1518,7 @@ static void printTorrentList(tr_variant* top)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::print(
|
fmt::print(
|
||||||
FMT_STRING("Sum: {:>9s} {:6.1f} {:6.1f}\n"),
|
FMT_STRING("Sum: {:>9s} {:6.1f} {:6.1f}\n"),
|
||||||
strlsize(total_size).c_str(),
|
strlsize(total_size).c_str(),
|
||||||
total_up / static_cast<double>(tr_speed_K),
|
total_up / static_cast<double>(tr_speed_K),
|
||||||
total_down / static_cast<double>(tr_speed_K));
|
total_down / static_cast<double>(tr_speed_K));
|
||||||
|
|
Loading…
Reference in New Issue