[erlang-questions] Setting TZ variable
Alain O'Dea
alain.odea@REDACTED
Thu Dec 2 18:13:48 CET 2010
Out of curiosity, do you need to change the timezone at runtime?
Otherwise the shell shook be fine. I use the shell approach to force
Zotonic into EST.
If you need runtime timezone handling I recommend using GMT and
putting in a dispay module to convert to the timezone needed by the
current process. Otherwise you could get strange behavior when otwo
process change the global timezone and get muddled in context
switching.
On Thursday, December 2, 2010, Alexey Romanov
<alexey.v.romanov@REDACTED> wrote:
> I've tried to follow the advice given by Ulf Wiger in this old thread:
> http://www.erlang.org/pipermail/erlang-questions/2006-December/024291.html
>
> However, it doesn't work for me:
>
> aromanov@REDACTED:~/workspace/gmcontroller$ erl
> Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0]
> [hipe] [kernel-poll:false]
>
> Eshell V5.8.1 (abort with ^G)
> 1> os:getenv("TZ").
> false
> 2> time().
> {17,49,40}
> 3> os:putenv("TZ", "GMT").
> true
> 4> os:getenv("TZ").
> "GMT"
> 5> time().
> {17,50,8}
>
> Am I doing something wrong?
>
> Setting TZ in the shell does work (but isn't suitable for my purposes):
>
> aromanov@REDACTED:~/workspace/gmcontroller$ TZ=GMT erl
> Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0]
> [hipe] [kernel-poll:false]
>
> Eshell V5.8.1 (abort with ^G)
> 1> os:getenv("TZ").
> "GMT"
> 2> time().
> {14,50,39}
>
> Yours, Alexey Romanov
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>
More information about the erlang-questions
mailing list