开发者

Linux: how to set up a timezone of a process?

开发者 https://www.devze.com 2023-01-13 22:54 出处:网络
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.

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开发者_Go百科 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 ;)


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"?


You might want to try something similar to dateshift or libfaketime, both of which let you run a program with offset time.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号