Skip to content

Commit

Permalink
ETA calculation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmhewitt committed Jul 30, 2021
1 parent 69c350a commit df41ff8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Widgets/TorrentListRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ public class Torrential.Widgets.TorrentListRow : Gtk.ListBoxRow {
}
}

public static string time_to_string (uint totalSeconds) {
public static string time_to_string (int totalSeconds) {
if (totalSeconds < 0) {
return "...";
}

uint seconds = (totalSeconds % 60);
uint minutes = (totalSeconds % 3600) / 60;
uint hours = (totalSeconds % 86400) / 3600;
Expand All @@ -176,10 +180,7 @@ public class Torrential.Widgets.TorrentListRow : Gtk.ListBoxRow {
var str_seconds = ngettext ("%u second", "%u seconds", seconds).printf (seconds);

var formatted = "";
if (totalSeconds == -1) {
formatted = "...";
}
else if (days > 0) {
if (days > 0) {
formatted = "%s, %s, %s, %s".printf (str_days, str_hours, str_minutes, str_seconds);
}
else if (hours > 0) {
Expand Down

0 comments on commit df41ff8

Please sign in to comment.