- Several typos and spelling mistakes in documentation
- Daemon:waittimesync_does_not_wait_with_new_interfaces test was failing if
the system used a time zone with a negative numeric value
+ - New
+ - Remove possible PollInterval and UpdateInterval drift over time
+ - Sync SaveInterval to full minutes
2.0 / 21-Oct-2018
if ((s->current - s->prevdbsave) >= (s->saveinterval) || s->forcesave) {
s->dodbsave = 1;
s->forcesave = 0;
- s->prevdbsave = s->current;
+ s->prevdbsave = s->current - (s->current % s->saveinterval);
} else {
s->dodbsave = 0;
}
/* update data cache */
} else {
- s.prevdbupdate = s.current;
+ s.prevdbupdate = s.current - (s.current % s.updateinterval);
adjustsaveinterval(&s);
checkdbsaveneed(&s);
}
if (s.running && intsignal == 0) {
- sleep((unsigned int)cfg.pollinterval);
+ sleep((unsigned int)(cfg.pollinterval - (time(NULL) % cfg.pollinterval)));
}
if (intsignal) {
DSTATE s;
initdstate(&s);
s.dodbsave = 2;
- s.current = 10;
- s.prevdbsave = 0;
+ s.current = 125;
+ s.prevdbsave = 110;
s.saveinterval = 30;
s.forcesave = 1;
checkdbsaveneed(&s);
ck_assert_int_eq(s.dodbsave, 1);
- ck_assert_int_eq(s.prevdbsave, s.current);
+ ck_assert_int_eq(s.prevdbsave, 120);
ck_assert_int_eq(s.forcesave, 0);
}
END_TEST
DSTATE s;
initdstate(&s);
s.dodbsave = 2;
- s.current = 60;
+ s.current = 65;
s.prevdbsave = 5;
s.saveinterval = 30;
s.forcesave = 0;
checkdbsaveneed(&s);
ck_assert_int_eq(s.dodbsave, 1);
- ck_assert_int_eq(s.prevdbsave, s.current);
+ ck_assert_int_eq(s.prevdbsave, 60);
ck_assert_int_eq(s.forcesave, 0);
}
END_TEST