service: explicitly cast float to usec_t

Let's cast these floats explicitly to usec_t, since implicit
float-to-integer casts are dangerous business, and we should underline
that there's a cast happening here.
This commit is contained in:
Lennart Poettering 2023-07-06 11:21:32 +02:00
parent ea792cacb9
commit 4ab426bf56

View file

@ -311,8 +311,8 @@ usec_t service_restart_usec_next(Service *s) {
* r_n : maximum restart usec (s->restart_max_delay_usec),
* i : index of the next step (n_restarts_next - 1)
* n : num maximum steps (s->restart_steps) */
value = s->restart_usec * powl((long double) s->restart_max_delay_usec / s->restart_usec,
(long double) (n_restarts_next - 1) / s->restart_steps);
value = (usec_t) (s->restart_usec * powl((long double) s->restart_max_delay_usec / s->restart_usec,
(long double) (n_restarts_next - 1) / s->restart_steps));
}
log_unit_debug(UNIT(s), "Next restart interval calculated as: %s", FORMAT_TIMESPAN(value, 0));