[ka-Map-users] Possible problem in tile.php

Pg pg.navone at gmail.com
Fri May 19 08:52:11 EDT 2006


Using the redraw_interval / refresh_interval i found some problems
with the timezone management.

In JS you use:

    this.timeStamp = Math.round(ts.getTime()/1000) +
ts.getTimezoneOffset() * 60;

But  Date.getTime() return itself the GMT time, so the TZ correction
is applied twice.

In PHP in the gmttime() function

 time() - $iDelta

but the builtin function time() give the UNIX Time (GMT).

So I applied the following patch:

----------------------------
tile.php: line 142

$now = time();

----------------------------
kaMap.js: line 2101

this.timeStamp = Math.round(ts.getTime()/1000);

----------------------------
kaMap.js: line 2269

this.timeStamp = Math.round(ts.getTime()/1000);


I tested it on Windows machines (with correct timezone configuration)
and Firefox.

2006/5/17, Paul Spencer <pspencer at dmsolutions.ca>:
> Thanks Pg, I've committed the change.  I believe there is no impact
> with changing the year, that line of code only figures out the delta
> for the local timezone
>
> Cheers
>
> Paul
>
> On 17-May-06, at 4:43 PM, Pg wrote:
>
> > With the CVS version on an XP machine tile.php doesn't generates tiles
> > and logs the following error:
> >
> > [17-May-2006 15:38:28] PHP Warning:  gmmktime(): Windows does not
> > support negative values for this function in
> > D:\ms4w\apps\ka-map\htdocs\tile.php on line 355
> > [17-May-2006 15:38:28] PHP Warning:  mktime(): Windows does not
> > support negative values for this function in
> > D:\ms4w\apps\ka-map\htdocs\tile.php on line 355
> >
> > My local-time is CEST (GMT+2).
> >
> > In the function gmttime() I changwed the line:
> >
> >   $iDelta = gmmktime(1, 1, 1, 1, 1, 1970, $aNow[8]) - mktime(1, 1, 1,
> > 1, 1, 1970, $aNow[8]);
> >
> > with:
> >
> >   $iDelta = gmmktime(1, 1, 1, 1, 1, 1980, $aNow[8]) - mktime(1, 1, 1,
> > 1, 1, 1980, $aNow[8]);
> >
> >
> > I'm not sure on the nature of the error and on the correcteness of the
> > solution, but it works for me.
> >
> > -Pg
> >
> > _______________________________________________
> > ka-Map-users mailing list
> > ka-Map-users at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/ka-map-users
>
> +-----------------------------------------------------------------+
> |Paul Spencer                           pspencer at dmsolutions.ca   |
> +-----------------------------------------------------------------+
> |Applications & Software Development                              |
> |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
> +-----------------------------------------------------------------+
>
>
>
>
>



More information about the ka-Map-users mailing list