Re: Length of a day.

Hi Eric,

      On October 29, 2001 you wrote[1]:

--- Excerpt from Eric's note ---
> Note that leap seconds screw up minutes, 
> hours and days.


Yes, and doesn't this means that the algorithm that add durations to 
dateTimes and considers that there are only two groups of values 
"Essentially, this calculation is equivalent to separating D into 
<year,month> and <day,hour,minute,second> fields" is not 100% exact?

This algorithm considers that the only variable quotients between 
datetime parts is between the groups <year,month> and 
<day,hour,minute,second> and from what you're saying, there should be 
three groups: <year,month>, <day> and <hour,minute,second>.
--- End of excerpt from Eric's note ---

     You are correct that the algorithm in Appendix E of "XML Schema: 
Datatypes" doesn't account for leap seconds, but that was a conscious 
decision on the part of the Schema Working Group.  It's difficult to 
imagine any other convenient way of dealing with the problem.  E.1 [2] 
points out that:

Leap seconds are handled by the computation by treating them as overflows. 
Essentially, a value of 60 seconds in S is treated as if it were a 
duration of 60 seconds added to S (with a zero seconds field). All 
calculations thereafter use 60 seconds per minute. 
Thus the addition of either PT1M or PT60S to any dateTime will always 
produce the same result. This is a special definition of addition which is 
designed to match common practice, and -- most importantly -- be stable 
over time. 
A definition that attempted to take leap-seconds into account would need 
to be constantly updated, and could not predict the results of future 
implementation's additions. 


Thanks,

Henry
[1] 
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2001OctDec/0112.html
[2] http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#section-Algorithm
------------------------------------------------------------------
Henry Zongaro      XML Parsers development
IBM SWS Toronto Lab   Tie Line 969-6044;  Phone (905) 413-6044
mailto:zongaro@ca.ibm.com

Received on Thursday, 20 December 2001 11:22:51 UTC