[MEDIUM] implement a monotonic internal clock
If the system date is set backwards while haproxy is running,
some scheduled events are delayed by the amount of time the
clock went backwards. This is particularly problematic on
systems where the date is set at boot, because it seldom
happens that health-checks do not get sent for a few hours.
Before switching to use clock_gettime() on systems which
provide it, we can at least ensure that the clock is not
going backwards and maintain two clocks : the "date" which
represents what the user wants to see (mostly for logs),
and an internal date stored in "now", used for scheduled
events.
diff --git a/src/checks.c b/src/checks.c
index be26711..eff0df0 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -356,7 +356,7 @@
if (s->proxy->options & PR_O_SSL3_CHK) {
/* SSL requires that we put Unix time in the request */
- int gmt_time = htonl(now.tv_sec);
+ int gmt_time = htonl(date.tv_sec);
memcpy(s->proxy->check_req + 11, &gmt_time, 4);
}