Hi, I just tried this with texlua 1.10.0: -------------------------------------------- local function time_of_day (TZ) os.setenv('TZ', TZ) local time = os.gettimeofday() print(os.date('%c', math.floor(time))) end time_of_day ('America/New_York') time_of_day ('Europe/Paris') time_of_day ('Asia/Tokyo') -------------------------------------------- It seems that os.setenv() is only executed once and all results are in Eastern Standard Time: Fri Feb 21 16:37:13 2020 Fri Feb 21 16:37:13 2020 Fri Feb 21 16:37:13 2020 When I call "time_of_day ('Asia/Tokyo')" first I get Sat Feb 22 06:39:46 2020 Sat Feb 22 06:39:46 2020 Sat Feb 22 06:39:46 2020 Is it possible to fix this behavior? Regards, Reinhard -- ------------------------------------------------------------------ Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ------------------------------------------------------------------
On Fri, Feb 21, 2020 at 10:50 PM Reinhard Kotucha
Hi, I just tried this with texlua 1.10.0:
-------------------------------------------- local function time_of_day (TZ) os.setenv('TZ', TZ) local time = os.gettimeofday() print(os.date('%c', math.floor(time))) end
time_of_day ('America/New_York') time_of_day ('Europe/Paris') time_of_day ('Asia/Tokyo') --------------------------------------------
It seems that os.setenv() is only executed once and all results are in Eastern Standard Time:
Fri Feb 21 16:37:13 2020 Fri Feb 21 16:37:13 2020 Fri Feb 21 16:37:13 2020
When I call "time_of_day ('Asia/Tokyo')" first I get
Sat Feb 22 06:39:46 2020 Sat Feb 22 06:39:46 2020 Sat Feb 22 06:39:46 2020
Is it possible to fix this behavior?
hm, just to be sure... how do you run your example ? -- luigi
On 2020-02-21 at 23:00:58 +0100, luigi scarso wrote:
On Fri, Feb 21, 2020 at 10:50 PM Reinhard Kotucha
wrote: Hi, I just tried this with texlua 1.10.0:
-------------------------------------------- local function time_of_day (TZ) os.setenv('TZ', TZ) local time = os.gettimeofday() print(os.date('%c', math.floor(time))) end
time_of_day ('America/New_York') time_of_day ('Europe/Paris') time_of_day ('Asia/Tokyo') --------------------------------------------
It seems that os.setenv() is only executed once and all results are in Eastern Standard Time:
Fri Feb 21 16:37:13 2020 Fri Feb 21 16:37:13 2020 Fri Feb 21 16:37:13 2020
When I call "time_of_day ('Asia/Tokyo')" first I get
Sat Feb 22 06:39:46 2020 Sat Feb 22 06:39:46 2020 Sat Feb 22 06:39:46 2020
Is it possible to fix this behavior?
hm, just to be sure... how do you run your example ?
texlua ./timeofday.lua I also tried texlua --shell-escape ./timeofday.lua Same result. Regards, Reinhard -- ------------------------------------------------------------------ Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ------------------------------------------------------------------
On Fri, Feb 21, 2020 at 11:11 PM Reinhard Kotucha
texlua ./timeofday.lua
I also tried
texlua --shell-escape ./timeofday.lua
Same result.
Regards, Reinhard
TZ is passed to the env.: local function time_of_day (TZ) os.setenv('TZ', TZ) local time = os.gettimeofday(); print(os.date('%c %p', math.floor(time))) print(TZ); os.execute("date +%c") ; print() os.setenv('TZ', nil) end under linux os.date calls localtime_r (if the string format doesn't start with '!') and localtime_r "need not set tzname, timezone, and daylight" I think that this means that the tz info are read only the first time See e.g. https://jianewyork.blogspot.com/2018/03/use-of-localtime-localtimer-and-thei... -- luigi
participants (2)
-
luigi scarso
-
Reinhard Kotucha