]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[MEDIUM] further improve monotonic clock by check forward jumps
authorWilly Tarreau <w@1wt.eu>
Mon, 23 Jun 2008 12:00:57 +0000 (14:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 23 Jun 2008 12:00:57 +0000 (14:00 +0200)
commitb0b37bcd657142d942e7ee8b1c7f1d3651db2d29
tree0755226a6ca35d5c04b9ecc6b415efd79aadaba4
parentb7f694f20e2eeb8f9020955bc64b0a55e9d33f50
[MEDIUM] further improve monotonic clock by check forward jumps

The first implementation of the monotonic clock did not verify
forward jumps. The consequence is that a fast changing time may
expire a lot of tasks. While it does seem minor, in fact it is
problematic because most machines which boot with a wrong date
are in the past and suddenly see their time jump by several
years in the future.

The solution is to check if we spent more apparent time in
a poller than allowed (with a margin applied). The margin
is currently set to 1000 ms. It should be large enough for
any poll() to complete.

Tests with randomly jumping clock show that the result is quite
accurate (error less than 1 second at every change of more than
one second).
include/common/time.h
src/cfgparse.c
src/ev_epoll.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/ev_sepoll.c
src/haproxy.c
src/proxy.c
src/time.c