lua-users home
lua-l archive

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


Time zone and daylight savings time difference for you?  When I try the example, I get differences in the hour and isdst fields.

$  lua -e 't = os.date("*t", 906000490);print(t.hour,t.min,t.sec,t.isdst)'
22 48 10 true

However, I use use a different timezone, it seems to be correct:

$ TZ=Brazil/East lua -e 't = os.date("*t", 906000490);print(t.hour,t.min,t.sec,t.isdst)'
23 48 10 false


On Apr 6, 2011, at 3:57 PM, Jeff Smith wrote:

Hi
 
While we are on the subject of os.date os.time etc. Can someone volunteer to check this for me please ?
 
PiL chapter 22 states
 
temp = os.date("*t", 906000490)
produces the table 

    {year = 1998, month = 9, day = 16, yday = 259, wday = 4,
     hour = 23, min = 48, sec = 10, isdst = false}
 
 
Is 906000490 the correct number here ? I cant get it to give me the table numbers stated below it ?
 
It could be me misunderstanding something, or is it a mistake ?
 
Regards Geoff
 
PS Do I win a prize for spotting a 13 year old mistake ? :)
 
 
 
> Date: Wed, 6 Apr 2011 12:31:16 -0300
> From: roberto@inf.puc-rio.br
> To: lua-l@lists.lua.org
> Subject: Re: os.time() vs. isdst
> 
> > On Wed, Apr 6, 2011 at 17:39, Roberto Ierusalimschy
> > <roberto@inf.puc-rio.br> wrote:
> > >> But maybe you can clarify os.date() definition in manual? It is not
> > >> obvious that this feature is supported. (Not sure about the wording
> > >> though.)
> > 
> > >  ...
> > >  and 'isdst' (daylight saving flag, a boolean).
> > > +This last field may be absent if the system
> > > +does not have this information.
> > 
> > Not sure about the mention of "system" — in os.time() it is user who
> > does not have the information.
> 
> We may just copy six words from the ISO standard:
> 
> +This last field may be absent 
> +if the information is not available.
> 
> -- Roberto
>