After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 153000 - Date has problems with time zones
Date has problems with time zones
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.8
Other All
: Normal major
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
: 153425 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-09-18 13:33 UTC by Jerome Pesenti
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jerome Pesenti 2004-09-18 13:33:17 UTC
As an example, the differences of times computed below are obviously wrong
(+04:00 and -04:00 are mixed up). More annoying, the function date:seconds(),
which should return the same value as time(NULL), may be wrong when
date:date-time() returns a non GMT date...).


[pesenti@dev vivisimo]$ cat /tmp/a.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
   xmlns:date="http://exslt.org/dates-and-times"
   extension-element-prefixes="date"
>
<xsl:template match="/">
  <xsl:value-of select="date:difference('1970-01-01T00:00:00+04:00',
'1970-01-01T04:00:00Z')"/>
  <br/>
  <xsl:value-of select="date:difference('1970-01-01T00:00:00-04:00',
'1970-01-01T04:00:00Z')"/>
</xsl:template>

</xsl:stylesheet>

[pesenti@dev vivisimo]$ xsltproc /tmp/a.xsl /tmp/a.xsl
<?xml version="1.0"?>
P0D<br/>PT8H

[pesenti@dev vivisimo]$ cat /tmp/b.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
   xmlns:date="http://exslt.org/dates-and-times"
   extension-element-prefixes="date"
>
<xsl:template match="/">
  <xsl:value-of select="date:seconds()"/>
</xsl:template>

</xsl:stylesheet>
[pesenti@dev vivisimo]$ xsltproc /tmp/b.xsl /tmp/b.xsl
<?xml version="1.0"?>
1095485514
[pesenti@dev vivisimo]$ date +'%s'
1095514317
[pesenti@dev vivisimo]$


[pesenti@dev vivisimo]$ xsltproc --version
Using libxml 20611, libxslt 10108 and libexslt 806
xsltproc was compiled against libxml 20611, libxslt 10108 and libexslt 806
libxslt 10108 was compiled against libxml 20611
libexslt 806 was compiled against libxml 20611
Comment 1 William M. Brack 2004-09-19 00:12:52 UTC
I agree with your analysis.  Apparently our library code had a (consistent) 
problem with timezone offset (a single line within the time "normalization" 
routine), but I hope I have it right now:

bill@bbrack bug153000 $ ./xsltproc a.xsl a.xsl
<?xml version="1.0"?>
PT8H<br/>P0D
bill@bbrack bug153000 $ ./xsltproc b.xsl b.xsl; date +'%s'
<?xml version="1.0"?>
1095551331
1095551331

Thanks for the clear report, and for the testing scripts.  I'm going to post 
something to the xsl mailing list advising people of the change I have made in 
case someone disagrees with it, but I really don't expect that to happen.  The 
fixed code (libexslt/date.c) is in CVS.
Bill
Comment 2 William M. Brack 2004-09-24 23:23:35 UTC
*** Bug 153425 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Veillard 2004-09-30 12:07:57 UTC
  The release of libxslt-1.1.11 should fix this,
                                                                                
   thanks,
                                                                                
Daniel