This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2354 - op-subtract-dateTimes-yielding-DTD-8 results wrong
Summary: op-subtract-dateTimes-yielding-DTD-8 results wrong
Status: RESOLVED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.8.0
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Carmelo Montanez
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-18 13:17 UTC by Michael Kay
Modified: 2005-12-02 20:44 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2005-10-18 13:17:54 UTC
The query is

xs:dateTime("0001-01-01T01:01:01Z") - xs:dateTime("2005-07-06T12:12:12Z")

The supplied answer is 

-P732134DT11H11M11S

I believe the correct answer is:

-P732132DT11H11M11S

Rationale: Between 0001-01-01 and 2005-01-01 there are 2004 years. Of these 486
are leap years (2004/4 minus the fifteen years 100, 200, 300, 500, 600, 700,
900, 1000, 1100, 1300, 1400, 1500, 1700, 1800, 1900). 

2004*365 + 486 = 731946

Add 186 for the days between 2005-01-01 and 2005-07-06

731946 + 186 = 732132

Michael Kay
Comment 1 Michael Kay 2005-10-18 13:32:43 UTC
Also affects

   op-subtract-dates-yielding-DTD-8
   

which is incorrectly identified as subtract-dayTimeDuration-from-date-8 (twice)
in the comment banner within the test file)
Comment 2 Carmelo Montanez 2005-10-28 15:28:10 UTC
I re-ran the tests and got the same answer.  Since the purpose is
to get a negative answer, I changed the tests to use closer
dates and dateTimes.  Resubmitted changed tests and new results.
Please close the bug if you agree with resolution.

Thanks,
Carmelo
Comment 3 Michael Kay 2005-10-29 09:26:02 UTC
If this test is finding bugs in implementations, then it seems to serve a useful
purpose, and it's a shame to replace it with a test that implementations find it
easier to pass. (I suspect the published results are what you get if you do the
arithmetic using a proleptic Julian claendar rather than a proleptic Gregorian
calendar). It would be better to keep the test and correct the expected results.
Comment 4 Carmelo Montanez 2005-10-31 19:41:33 UTC
Revising test.

Carmelo
Comment 5 Carmelo Montanez 2005-11-01 15:02:55 UTC
Mike:

You are correct.  Resubmitted original tests (corrected names inside
test cases) and suggested expected results.  Please close bug if in 
agreement.

Thanks,
Carmelo Montanez
Comment 6 Alberto Massari 2005-11-08 15:41:40 UTC
Michael,
I think the correct result is -P732134DT11H11M11S, as it looks like the years 4
A.D. and 8 A.D. were not declared leap years.
Try to go to the page http://www.numerical-recipes.com/julian.html and enter Jan
1 0001 as the starting date, 732134 as the number of days and check that the
result is Jul 6 2005

Alberto
Comment 7 Alberto Massari 2005-11-08 15:42:38 UTC
Also, the same applies to op-subtract-dates-yielding-DTD-8
Comment 8 Michael Kay 2005-11-08 15:58:20 UTC
XPath arithmetic and the XML Schema dateTime type use a proleptic Gregorian
calendar, in which AD 4 and AD 8 are indeed leap years.

http://en.wikipedia.org/wiki/Proleptic_Gregorian_Calendar
Comment 9 Carmelo Montanez 2005-12-02 20:44:07 UTC
We seems to be ok here.