I'd need to set timezones of individual processes started on a linux box. I tried setting TZ variable (in the local context), but it didn't work.
Is there a way of running an app from a command line with a different system date to the system one? It might sound stupid, but I need a kind of a sandbox where the system date would be changed.
Starting a virtual box is not an option ;)
Asked
Active
Viewed 7,722 times
5

Dave
- 390
- 4
- 12
2 Answers
5
Which program do you use? Setting TZ works here:
turboj@linux:~> date
Do 2. Sep 11:59:26 CEST 2010
turboj@linux:~> export TZ=UTC
turboj@linux:~> date
Do 2. Sep 09:59:34 UTC 2010
Maybe you forgot to "export"?

Turbo J
- 7,563
- 1
- 23
- 43
-
Nah mate, that won't do :( I'm starting a python script like that: TZ=GMT15 python a.py The problem is, I have to use a dodgy C library which connects to a DB and calculates some data based on a client's timezone. Whatever happens in the library, I've got no control over it. What I know for sure: if I set the client's os to GMT15 it works fine. Unfortunately in prod environment I'm not a root user and I have to be able to change the date in a local context of a client. Does that make any sense? ;) – Dave Sep 02 '10 at 10:18
4
You might want to try something similar to dateshift or libfaketime, both of which let you run a program with offset time.

Hasturkun
- 35,395
- 6
- 71
- 104