lua-users home
lua-l archive

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


Thanks for the clarification guys, yes thats the explanation, the discrepancy is the timezone difference of 3 hours (I am in the UK)
 
I  maintain that is a pretty horrid example for a newbie reading that os.date page, as there is no mention of time zone dependancy at that point. Not totally suprisingly it didnt occur to me you have to be typing away at a PC in Brazil for the numbers to work out correctly !
 
Thats another prize I havent won then :)
 
Regards Geoff
 
 

From: louie@transsys.com
Date: Wed, 6 Apr 2011 17:09:18 -0400
To: lua-l@lists.lua.org
Subject: Re: os.time() vs. isdst

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
>