This doesn't work with everything (for example doesn't work with Go because Go doesn't use libc for such things) but if it does then it's a very simple to use:
% LD_PRELOAD=src/libfaketime.so.1 FAKETIME='1999-12-31 23:59:59' date
Fri Dec 31 23:59:59 PST 1999
% LD_PRELOAD=src/libfaketime.so.1 FAKETIME='1999-12-31 23:59:59' python -c 'import time;print(time.ctime())'
Fri Dec 31 23:59:59 1999
or to have the fake clock ticking starting from the specified time:
% LD_PRELOAD=src/libfaketime.so.1 FAKETIME='@1999-12-31 23:59:59' python -c 'import time;print(time.ctime());time.sleep(1);print(time.ctime())'
Fri Dec 31 23:59:59 1999
Sat Jan 1 00:00:00 2000
This doesn't work with everything (for example doesn't work with Go because Go doesn't use libc for such things) but if it does then it's a very simple to use:
or to have the fake clock ticking starting from the specified time: