lua-users home
lua-l archive

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


In Lua 5.1, when you have a non-UTC timezone (e.g. set TZ="EST+9")
When you run: `os.date("!%s")` it will give you a timestamp doubly-adjusted for your time zone.

    $ lua5.1 <<< 'print(os.date("!%s",1234567890))'
    1234600290

This seems to be an unfortunate side effect of how %s is specified:
> The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). (TZ)

This isn't an issue in Lua 5.2, as http://www.lua.org/source/5.2/loslib.c.html#LUA_STRFTIMEOPTIONS does not include "s"

Daurn.