lua-users home
lua-l archive

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


On Tue, Mar 28, 2017 at 1:34 PM, Oliver Kroth <oliver.kroth@nec-i.de> wrote:
> os.time() normally operates on local time. I usually apply a correction:
> utc = os.time{ ...some table ...} - os.time{year=1970, month=1, day=1,
> hour=0}
> which subtracts the offset to local time.

Doesn't this have a problem with DST? In my system, TZ=Europe/Madrid:

> now=os.time()
> os.date("%c", now)
Tue Mar 28 13:22:36 2017
> os.date("!%c", now)
Tue Mar 28 11:22:36 2017
> os.time{year=1970, month=1, day=1, hour=0}
-3600
> os.date("%Z", now)
CEST
( Central Europe daylight Saving Time )

And remember timezones evolve with time.

Francisco Olarte.