Tricking Linux apps about current time with environment variables
- by geek
Sometimes it is possible to trick a Linux app by calling it like this:
HOME=/tmp/foo myapp
This would make myapp think /tmp/foo is the home directory, it won't try to get the user id, find its home directory via getpwent().
This is useful when myapp must be forced to dump some of its config files into a non-standard location different than ~.
A similar trick can be done like this:
LANG=foo LC_ALL=bar myapp
This is useful when myapp needs to be called once with a different locale without having to make the change persistent by using the export bash built-in or even modify stuff in /etc/profile.
Is it possible to pull the same trick with time and date?
The goal is to make an app use another time than the system ones.
The final goal - to make timestamps that appear in logs/commit messages not being tied to the system time.