I am using the librarie "libfaketime" to fake the time of my system. My objective is to change the time inside a docker container, independently of the host time. It can allow me to transform the container as a ntp server, distributing the fake time to the host. (I know I shouldn't sync a ntp server to itself, and i shouldn't peer to a server giving fake time but it is for testing purposes).
By looking at the readme, i found the possibility to change the date and time system-wide, faking directly the output of the date command.
It is using environment variables and the file /etc/faketimerc
. The file is allowing the time modification wanted. Details on the exact configuration.
I replicated the configuration of the link above, I have all 3 environment variables and the file configured. But I cant change the output of the date command.
The librarie is working when I use basic modification like : faketime -f ‘-10d’ date` (echo the fake time to the terminal).
Edit : For information, libfaketime doesn't change the time distributed by the server (running ntpd). So the client is not stepping to the fake time displayed by the date command.
0 Answers