Seems like libc must not check the TZ variable each time, possibly due to
performance considerations?

On Monday, November 2, 2015, Avik Sengupta <avik.sengu...@gmail.com> wrote:

> I'm not sure why this behaves differently. The now() function calls down
> to time_now() in libc, and while we do a setenv() when changing ENV,
> clearly that change is not reaching down to the relevant parts of libc.
>
> In terms of workaround, if you wanted UTC time, then `now(Base.Dates.UTC)`
> will give you that. For other timezone conversions, you may want to look at
> the TimeZones package.  (https://github.com/quinnj/TimeZones.jl)
>
> On Sunday, 1 November 2015 16:10:52 UTC, Josef Sachs wrote:
>>
>> Works as expected with `julia -e`, but the environment variable
>> does not seem to be respected when set in the REPL.  Can someone
>> explain the reason, and possibly provide a workaround?
>>
>> $ TZ=UTC julia -e 'println(now())'
>> 2015-11-01T16:02:37
>> $ julia -e 'println(now())'
>> 2015-11-01T11:02:42
>> $ julia -e 'ENV["TZ"] = "UTC"; println(now())'
>> 2015-11-01T16:03:07
>> $ julia
>>                _
>>    _       _ _(_)_     |  A fresh approach to technical computing
>>   (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
>>    _ _   _| |_  __ _   |  Type "?help" for help.
>>   | | | | | | |/ _` |  |
>>   | | |_| | | | (_| |  |  Version 0.4.1-pre+22 (2015-11-01 00:06 UTC)
>>  _/ |\__'_|_|_|\__'_|  |  Commit 669222e (0 days old release-0.4)
>> |__/                   |  x86_64-linux-gnu
>>
>> julia> ENV["TZ"] = "UTC"; println(now())
>> 2015-11-01T11:03:28
>>
>

Reply via email to