Clock and Network simulator (clknetsim)

clknetsim is a tool designed to test programs which synchronize the system
clock, either over network or from a hardware reference clock. It simulates a
system or a number of systems connected to each other in a network and the
tested programs discipline the simulated system clocks. It can be used to
quickly test how well the programs control the system clocks in various
conditions or to test the network protocols.

The tested programs are not modified in order to be included in the simulation,
but they have some system calls redirected by a clknetsim library, which is
loaded by the LD_PRELOAD feature of the dynamic linker, to a clknetsim server,
which runs the simulation and collects several statistics about each client.
The server and the clients run on a single host, they communicate via a UNIX
domain socket. The simulation runs as fast as the host system is capable of,
with two simulated systems it is usually three or four orders of magnitude
faster than real time.