Commit e1bc8209 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix badly flawed announce delay computation.

Bug reported by Pierre Beyssac.
parent 146eaa1e
......@@ -239,18 +239,11 @@ int main(int argc, char *argv[])
daemon(0,0);
}
unsigned n = config.Programs.size() ?: 1;
div_t d = div ((1000000000 / n) * config.GetDelay(), 1000000000);
struct timespec delay;
if (config.Programs.size() == 1)
{
delay.tv_sec = 1;
delay.tv_nsec = 0;
}
else
{
delay.tv_sec = 0;
delay.tv_nsec = 1000000000 * config.GetDelay()
/ config.Programs.size();
}
delay.tv_sec = d.quot;
delay.tv_nsec = d.rem;
signal (SIGINT, exit_handler);
signal (SIGTERM, exit_handler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment