Check for zero-value in recalc_stops

master
Kenny Levinsen 2020-09-27 16:08:26 +02:00
parent a74f7fd44f
commit 0128fb535f
1 changed files with 3 additions and 1 deletions

4
main.c
View File

@ -243,7 +243,9 @@ static void set_temperature(struct context *ctx) {
static void recalc_stops(struct context *ctx, time_t now) { static void recalc_stops(struct context *ctx, time_t now) {
time_t day = now - (now % 86400); time_t day = now - (now % 86400);
time_t true_end = ctx->stop_time + ctx->duration; time_t true_end = ctx->stop_time + ctx->duration;
if (now > true_end) { if (ctx->stop_time == 0) {
// First calculation
} else if (now > true_end) {
day += 86400; day += 86400;
} else if (day < true_end) { } else if (day < true_end) {
return; return;