lua-users home
lua-l archive

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


Oliver:

On Tue, Mar 28, 2017 at 2:20 PM, Oliver Kroth <oliver.kroth@nec-i.de> wrote:
> Am 28.03.2017 um 13:43 schrieb Francisco Olarte:
>> 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:
> Actually, no. At my Lua implementation
> os.time{year=1970,month=1,day=1,hour=0,isdst=true}
> returns -7200
> which is correct for our time zone CETD.

¿ And with timezone is that ? Because my system parses it as UTC (
BTW, my example of CEST was bad too ).

Seen what you did there, but that is not the original code you posted.

The isdst value you are using is not correct all year round ( in fact
at your time zone I doubt it was true on january the first any year )

You would have to first try it, then pass it back to os.date() to see
if dst is in effect and then do it again with isdst true. And even
this assumes your time zone definition as been the same since 1970. In
fact mine ( Europe/Madrid ) seend to be have been changing a lot, just
try

for a in $(seq 1910 2010); do TZ=Europe/Madrid date -d "$a-07-01" '+%z %c'; done

Francisco Olarte.