I would like to change the perception of real time for one process.
Making the process believe that time is passing at 50% or 150% of the speed my system/kernel/hardware-clock thinks.
I'd like to find a generic solution that can be used with any program, without having to patch the program's source code.
Is there any tool to achieve what I need?
Best Answer
That's what the
faketime
command is designed for. For instance:Started that shell with the clock going 10 times as fast as normal (that
sleep 10
slept for 1 second).Clock can be slowed down by using fractional multiplier (like 0.5 or 0,5 (depending on your locale) for every faked second to last 2 real seconds. See for instance:
That works by injecting code into executables with
LD_PRELOAD
, so won't work for statically linked applications orsetuid
/setgid
executables, or applications that execute commands in sanitized environments or in user namespaces, or which obtain time information or sleep without using the libc system call wrappers.