[xml] date-time strangeless last night



Last night, date:seconds() started returning invalid values. To test I created a simple stylesheet that simply printed

<xsl:value-of select="date:seconds()"/>

It printed a time from the day before. Coincidentally, this started happening after 8pm EDT which would be when my time was in September and the GM time was in October. The code (line 791 of 1.1.17) looks pretty suspicious to me:

    ret->value.date.tzo = (((ret->value.date.day * 1440) +
                            (ret->value.date.hour * 60) +
                             ret->value.date.min) -
                           ((gmTm->tm_mday * 1440) + (gmTm->tm_hour * 60) +
                             gmTm->tm_min));

which seems to be computing the seconds between localtime and gmtime. With no mention of month I can't see how that is right... I assume something similar but worse will happen at the end of the year.

I can reproduce this problem by adding

secs = 1159664596;

immediately after the call to time(NULL) in exsltDateCurrent while running the software on a machine in EDT. When I do this, the value of tzo is 2000 while the correct value should be -240.

Cheers,
Chris.



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