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 154021 - date:add-duration is buggy
date:add-duration is buggy
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-09-29 02:01 UTC by Mike Hommey
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike Hommey 2004-09-29 02:01:04 UTC
(This bug report has originally been made on
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271754 , this is a copy/paste ;
the original report was against 1.1.8, but I can reproduce on 1.1.10)

The EXSLT function date:add-duration() produces bad values on some
inputs described here.  Apply the following stylesheet to any XML
document (the XML input is ignored) using xsltproc to reproduce.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:date="http://exslt.org/dates-and-times" version="1.0">

  <xsl:output method="text"/>

<xsl:variable name="nl">
<xsl:text>
</xsl:text>
</xsl:variable>

  <xsl:template match="/">
    <xsl:variable name="myduration1" select="'-P28DT23H55M8S'"/>
    <xsl:variable name="myduration2" select="'-P1DT12H54M59S'"/>
    <xsl:value-of select="date:add-duration($myduration1, $myduration2)"/>
    <xsl:value-of select="$nl"/>
  </xsl:template>

</xsl:stylesheet>

The buggy output from libxslt1.1 is:
-P31DT11H9M53S

The correct output should be:
-P30DT12H50M7S
Comment 1 William M. Brack 2004-09-30 18:34:58 UTC
I did some further enhancement to the date.c routines involved with negative periods, and (I hope) 
corrected this problem together with a similar problem in date:sum.  The corrected source is in CVS 
(libexslt/date.c).
Comment 2 Daniel Veillard 2005-09-05 09:44:19 UTC
This should be closed by release of libxslt-1.1.15

  thanks,

Daniel