Is it possible on any Linux to force a timezone offset that is outside the "valid" range -12 to +14?
I'm looking for a way to temporarily simulate a "local time" (for testing purposes) that might be days into the future, if possible without actually changing the system clock.
Best Answer
It is possible to use any timezone name that doesn't exist and set the time up to +- 24 hours. Assuming that
MYFAKETIME
doesn't exist as a valid timezone (it doesn't yet, but may be defined in the future (very unlikely)), then, this is possible:Note that timezones above 24 just don't work. They do not change the time but are limited to the range
-24
to+24
. From 21.4.7 Specifying the Time Zone with TZSo, there is no way to change the time to "days into the future" using the TZ variable.
The real solution is to use the
faketime
utility (from the package of the same name).That will allow you to do: