In message <5eb0fefc54.DaveMeUK@my.inbox.com>
Dave Higton <dave@davehigton.me.uk> wrote:
>I don't know whether this is relevant at this stage.
>
>I've been putting together a few noddy Javascript examples. I noticed
>tonight that the date function shows the time zone as being +02:00 and
>shows the time as being 2 hours later than UTC. I'm wondering if it
>is adding DST to a time that already has DST. My Iyonix is completely
>set up for the UK. AFAIK it's the settings you'd expect anyone in the
>UK to have.
>
>NS #2953.
Right, I've tracked this down... sort of.
In duktape.c, function duk_bi_date_get_local_tzoffset_gmtime() is
called, but returns 7200.
The salient pints are:
gmtime_r(&t, &tms[0]);
localtime_r(&t, &tms[1]);
/* At ths point, tms[0].tm_hour is the UTC hour, tms[0].tm_isdst is 0;
tms[1].tm_hour is the local hour (1 greater than the UTC hout 'cos
we're currently in daylight savings), and tms[1].tm_isdst = 1.
I think those values are what one would expect. */
t1 = mktime(&tms[0]);
t2 = mktime(&tms[1]);
if (tms[1].tm_isdst > 0) {
t2 += 3600;
}
/* Now why on earth do they do that? t2 is a local time, and as such
is already corrected for DST - shouldn't it be? */
return (t2 - t1);
This is around lines 27864 to 27910 in duktape.c.
I'm not finding clear answers on the Internet as to whether localtime_r()
should return numbers that already directly represent the local legal
time, or the non-DST time in that time zone and expect the tm_isdst flag
to be used to add an hour offset.
Dave
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
No comments:
Post a Comment