[Bug 5939] [FO] Unintuitive results from op:time-equal

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5939





--- Comment #7 from Bogdan Butnaru <bogdanb+w3c+bugzilla@gmail.com>  2009-05-08 13:48:55 ---
(In reply to comment #6)
> >two xs:time values that have the same canonical representation* can 
> > be not equal
> Sorry, I don't understand how that can happen. Can you explain please?

According to the first example at
http://www.w3.org/TR/2007/REC-xpath-functions-20070123/#func-time-equals-examples

*** quote ***
op:time-equal(xs:time("08:00:00+09:00"), xs:time("17:00:00-06:00")) returns
false. The xs:dateTimes calculated using the reference date components are
1972-12-31T08:00:00+09:00 and 1972-12-31T17:00:00-06:00. These normalize to
1972-12-30T23:00:00Z and 1972-12-31T23:00:00.
*** end quote ***

However, according to
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#time-canonical-repr 

*** quote ***
The canonical representation for time is defined by prohibiting certain options
from the Lexical representation (§3.2.8.1). Specifically, either the time zone
must be omitted or, if present, the time zone must be Coordinated Universal
Time (UTC) indicated by a "Z". Additionally, the canonical representation for
midnight is 00:00:00.
*** end quote ***

This means that an xs:time value with a timezone must be adjusted to UTC. The
spec does not specify exactly how this is done, but
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#time-lexical-repr says
*** quote ***
The lexical representation for time is the left truncated lexical
representation for dateTime: hh:mm:ss.sss with optional following time zone
indicator. For example, to indicate 1:20 pm for Eastern Standard Time which is
5 hours behind Coordinated Universal Time (UTC), one would write:
13:20:00-05:00. See also ISO 8601 Date and Time Formats (§D). 
*** end quote ***

The latter implies that the value for the "hh" field can only be between 00 and
24 (see
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dateTime-lexical-representation
— the sixth bullet point); also, time values cannot be negative. This
suggests that when adjusting a timezoned xs:time value to UTC, it wraps around
to remain between “00:00:00” and “23:59:59.(9)”

This means that the canonical representations for the values in the example
(first quote above), xs:time("08:00:00+09:00") and xs:time("17:00:00-06:00"),
must both be “23:00:00Z” (8-9 = -1; -1 mod 24 = 23; 17+6 = 23). Yet the
example claims that they are not op:time-equal.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 8 May 2009 13:49:08 UTC