Skip to content

Commit

Permalink
Capped percent complete in monitor.c (#825)
Browse files Browse the repository at this point in the history
* phillip/823: capped percent complete

* Compile :(

* phillip/823: fixed issue closer to source

* phillip/823: cleanup code and reduce unnecessary loops

* phillip/823: compile

* phillip/823: comment nit
  • Loading branch information
phillip-stephens committed Mar 16, 2024
1 parent 3939d83 commit df098d8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/monitor.c
Expand Up @@ -158,9 +158,19 @@ double compute_remaining_time(double age, uint64_t packets_sent,
remaining[4] =
(1. - done) * (age / done) + zconf.cooldown_secs;
}
return min_d(remaining, sizeof(remaining) / sizeof(double));
double remaining_time = min_d(remaining, sizeof(remaining) / sizeof(double));
if (remaining_time < 0) {
// remaining time cannot be less than zero
return 0;
}
return remaining_time;
} else {
return zconf.cooldown_secs - (now() - zsend.finish);
double remaining_time = zconf.cooldown_secs - (now() - zsend.finish);
if (remaining_time < 0) {
// remaining time cannot be less than zero
return 0;
}
return remaining_time;
}
}

Expand Down

0 comments on commit df098d8

Please sign in to comment.