[erlang-questions] Setting TZ variable
Alexey Romanov
alexey.v.romanov@REDACTED
Thu Dec 2 21:44:58 CET 2010
On Thu, Dec 2, 2010 at 8:13 PM, Alain O'Dea <alain.odea@REDACTED> wrote:
> Out of curiosity, do you need to change the timezone at runtime?
Yes. The requirement probably could be worked around (e.g. by
restarting the system when the timezone changes) but it would be
better if I can avoid this.
> 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.
Ah no, I need precisely to handle actual timezone change (the system
only finds at runtime what timezone it's in by asking a server...)
> 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
>>
>>
>
--
Yours, Alexey Romanov
More information about the erlang-questions
mailing list