lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


scenario:
1. start Lua VM compiled with posix flag running process and use os.date()
2. change system wide timezone settings
3. use again os.date() from the earlier started process

expected result:
changes in system wide timezone settings should reflect return value for os.date()

actual result:
os.date() return value are based on the timezone settings when the Lua VM process was created

proposed fix:

--- lua-5.2.3/src/loslib.c 2013-04-12 20:48:47.000000000 +0200
+++ pa/lua-5.2.3/src/loslib.c 2014-10-31 02:05:13.345167821 +0100
@@ -200,8 +200,12 @@
     stm = l_gmtime(&t, &tmr);
     s++;  /* skip `!' */
   }
-  else
+  else {
+#if defined(LUA_USE_GMTIME_R)
+    tzset();
+#endif
     stm = l_localtime(&t, &tmr);
+  }
   if (stm == NULL)  /* invalid date? */
     lua_pushnil(L);
   else if (strcmp(s, "*t") == 0) {