lua-users home
lua-l archive

Re: os.time() modifies the argument

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


Il 2017年1月28日 10:56:49 +0300 Egor Skriptunoff <egor.skriptunoff@gmail.com> scrisse:
> > the `isdst` field was forcibly overridden: it was
> > explicitly set to false, but the call to os.time ignored that and
> > changed it to true anyway.
> > 
> 
> "isdst" is not an independent parameter.
> It could not be set to whatever user wants.
> "isdst" is calculated based on the date and the location (your time zone).
> This is similar to how "wday" is calculated as function of the date.
I disagree on this: isdst is an input parameter for os.time() and
I set it to false because I explicitely want the time without the
daylight saving correction. This works:
$ lua
Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio
> os.time { year=2016, month=6, day=20, isdst=false }
1466420400
> os.time { year=2016, month=6, day=20, isdst=true }
1466416800
That said, I found an old post of LHF where was said that isdst is
a tribool: true/false/nil. What you are describing is the behavior
when isdst is nil.
Ciao.
-- 
Nicola

AltStyle によって変換されたページ (->オリジナル) /